# ex_set_terminal.ppl
#
# The code in this file is part of Pyxplot
# <http://www.pyxplot.org.uk>
#
# Copyright (C) 2006-2012 Dominic Ford <coders@pyxplot.org.uk>
#               2008-2012 Ross Church
#
# $Id: ex_set_terminal.ppl 1261 2012-07-11 21:38:05Z dcf21 $
#
# Pyxplot is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# You should have received a copy of the GNU General Public License along with
# Pyxplot; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA  02110-1301, USA

# ----------------------------------------------------------------------------

# This script produces a figure for the Pyxplot Users' Guide

# Call common initialisation script
reset
title = "ex_set_terminal"
load "examples/fig_init.ppl"

# Main body of figure script
set preamble r'\usepackage{wasysym}'
set multiplot
set nodisplay
set axis x invisible
set nokey
set noclip
set texthalign center
set textvalign center
text r"{\bf Image formats}" at -2,12/4*0.4*5+2.0
set axis x2 mirror top
set width 5
set size ratio 12/4*0.4
set x2label r"{\bf Properties}"
set x2range[0.2:4.3]
set x2tics ("Live display" 1, "Vector graphics" 2, "Rasterised graphics" 3, "Lossy format" 4)
set x2format auto rotate 30
set axis y visible mirror left
set yrange[12.6:0.4]
set ytics ( \
r"{\tt bmp}" 1, \
r"{\tt eps}" 2, \
r"{\tt gif}" 3, \
r"{\tt jpeg}" 4, \
r"{\tt pdf}" 5, \
r"{\tt png}" 6, \
r"{\tt postscript}" 7, \
r"{\tt svg}$^{\bf\ddagger}$" 8, \
r"{\tt tif}" 9, \
r"{\tt X11\_multiWindow}" 10, \
r"{\tt X11\_persist}" 11, \
r"{\tt X11\_singleWindow}" 12 \
)
set grid x2y1
set gridmajcol gray80
set gridmincol null

yes   = r"\CIRCLE"
no    = r"\Circle"
maybe = r"$\bf\dagger$"

conditional(a,b,c) = a?b:c

i=1
foreach datum a,b,c,d in '--'
 {
  set label 10*i+1 conditional(a==2,maybe,conditional(a,yes,no)) at second 1, first i
  set label 10*i+2 conditional(b==2,maybe,conditional(b,yes,no)) at second 2, first i
  set label 10*i+3 conditional(c==2,maybe,conditional(c,yes,no)) at second 3, first i
  set label 10*i+4 conditional(d==2,maybe,conditional(d,yes,no)) at second 4, first i
  i=i+1
 }
0 0 1 0
0 1 0 0
0 0 1 2
0 0 1 1
0 1 0 0
0 0 1 0
0 1 0 0
0 1 0 0
0 0 1 0
1 1 0 0
1 1 0 0
1 1 0 0
END

plot

text r"\parbox{10cm}{$\bf\dagger$ -- Although the {\tt gif} image format is not lossy in the traditional sense, it reduces the number of colors to a palette of no more than 256~unique colors. Thus, whilst it is lossless for images which only contain small numbers of unique colors, some color distortion may occur in colorful images.\vspace{2mm}\newline$\bf\ddagger$ -- The {\tt svg} terminal is experimental and may be unstable. It relies upon the use of the {\tt svg} output device in ghostscript, which may not be present on all systems.}" at -4,-0.5 hal l val t

set display
refresh

# Call common cleanup script
load "examples/fig_end.ppl"

