2 %% This is the style file for the gnuplot PGF/TikZ terminal
4 %% It is associated with the 'gnuplot.lua' script, and usually generated
5 %% automatically. So take care whenever you make any changes!
7 \NeedsTeXFormat{LaTeX2e
}
8 \ProvidesPackage{gnuplot-lua-tikz
}%
9 [2009/
05/
26 (rev.
96a) GNUPLOT Lua terminal style
]
11 \RequirePackage{tikz,xxcolor,ifpdf,ifxetex
}
13 \usetikzlibrary{arrows,patterns,plotmarks
}
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23 \def\gp@rawimage@pdf
#1#2#3#4#5#6{%
26 \ifx\gp@tempa
\gp@tempb
%
31 \pgf@sys@bp
{#4}\pgfsysprotocol@literalbuffered
{0 0}\pgf@sys@bp
{#5}%
32 \pgfsysprotocol@literalbuffered
{0 0 cm
}%
33 \pgfsysprotocol@literalbuffered
{BI /W
#2 /H
#3 /CS
\gp@temp
}%
34 \pgfsysprotocol@literalbuffered
{/BPC
8 /F /AHx ID
}%
35 \pgfsysprotocol@literal
{#6 > EI
}%
37 \def\gp@rawimage@ps
#1#2#3#4#5#6{%
40 \ifx\gp@tempa
\gp@tempb
%
45 \pgfsysprotocol@literalbuffered
{0 0 translate
}%
46 \pgf@sys@bp
{#4}\pgf@sys@bp
{#5}\pgfsysprotocol@literalbuffered
{scale
}%
47 \pgfsysprotocol@literalbuffered
{#2 #3 8 [#2 0 0 -
#3 0 #3]}%
48 \pgfsysprotocol@literalbuffered
{currentfile /ASCIIHexDecode filter
}%
49 \pgfsysprotocol@literalbuffered
{false
\gp@temp
\space colorimage
}%
50 \pgfsysprotocol@literal
{#6 >
}%
55 \def\gp@rawimage
{\gp@rawimage@pdf
}
58 \def\gp@rawimage
{\gp@rawimage@pdf
}
60 \def\gp@rawimage
{\gp@rawimage@ps
}
65 \def\gp@image@size
{#1}%
67 %% \gprawimage{color model}{xcoord}{ycoord}{# of xpixel}{# of ypixel}{xsize}{ysize}{rgb/cmyk hex data RRGGBB/CCMMYYKK ...}
68 %% color model is 'cmyk' or 'rgb' (default)
69 \def\gprawimage#1#2#3#4#5#6#7#8{%
70 \tikz@scan@one@point
\gp@set@size(
#6,
#7)
\relax%
71 \tikz@scan@one@point
\pgftransformshift(
#2,
#3)
\relax%
73 \pgfsys@beginpurepicture
%
74 \gp@image@size
% fill \pgf@x and \pgf@y
75 \gp@rawimage
{#1}{#4}{#5}{\pgf@x
}{\pgf@y
}{#8}%
76 \pgfsys@endpurepicture
%
81 % gnuplottex comapatibility
82 % (see http://www.ctan.org/tex-archive/help/Catalogue/entries/gnuplottex.html)
85 \def\gnuplottexextension@lua
{\string tex
}
88 % gnuplot variables getter and setter
92 \expandafter\xdef\csname gp@var@
#1\endcsname{#2}
96 \csname gp@var@
#1\endcsname %
103 % short for the lengthy xcolor rgb definition
104 \def\gprgb#1#2#3{rgb,
1000:red,
#1;green,
#2;blue,
#3}
106 % short for a filled path
107 \def\gpfill#1{\path[fill,
#1]}
109 % short for changing the linewidth
110 \def\gpsetlinewidth#1{\pgfsetlinewidth{#1\gpbaselw}}
112 \def\gpsetlinetype#1{\tikzstyle{gp path
}=
[#1,
#1 add
]}
114 % short for changing the pointsize
115 \def\gpsetpointsize#1{\tikzstyle{gp point
}=
[mark size=
#1\gpbasems]}
117 % wrapper for color settings
118 \def\gpcolor#1{\pgfsetcolor{#1}}
120 % prevent plot mark distortions due to changes in the PGF transformation matrix
121 % use `\gpscalepointstrue' and `\gpscalepointsfalse' for enabling and disabling
124 \newif\ifgpscalepoints
125 \tikzoption{gp shift only
}[]{%
128 % this is actually the same definition as used by "shift only" (seen
129 % in pgf-1.18 and later)
130 \tikz@addtransform
{\pgftransformresetnontranslations}%
134 \path[solid
] plot
[only marks,gp point,
#1,mark options=
{gp shift only
}] coordinates
{#2};
%
137 \def\gpfontsize#1#2{\fontsize{#1}{#2}\selectfont}
140 % char size calculation, that might be used with gnuplottex
142 % Example code (needs gnuplottex.sty):
144 % % calculate the char size when the "gnuplot" style is used
145 % \tikzset{gnuplot/.append style={execute at begin picture=\gpcalccharsize}}
147 % \tikzset{gnuplot/.append style={font=\ttfamily\footnotesize}}
149 % \begin{tikzpicture}[gnuplot]
150 % \begin{gnuplot}[terminal=lua,%
151 % terminaloptions={tikz solid nopic charsize \the\gphcharsize,\the\gpvcharsize}]
157 % The `\gpcalccharsize' command fills the lengths \gpvcharsize and \gphcharsize with
158 % the values of the current default font used within nodes and is meant to be called
159 % within a tikzpicture environment.
161 \newdimen\gpvcharsize
162 \newdimen\gphcharsize
163 \def\gpcalccharsize{%
164 \pgfinterruptboundingbox%
165 \pgfsys@begininvisible
%
167 \global\gphcharsize=
1.05\fontcharwd\font`
0%
168 \global\gpvcharsize=
1.05\fontcharht\font`
0%
169 \global\advance\gpvcharsize by
1.05\fontchardp\font`g
%
171 \pgfsys@endinvisible
%
172 \endpgfinterruptboundingbox%
176 % define a rectangular node in tikz e.g. for the plot area
177 % FIXME: this is done globally to work with gnuplottex.sty
180 % #2 coordinate of "south west"
181 % #3 coordinate of "north east"
183 \def\gpdefrectangularnode#1#2#3{%
184 \expandafter\gdef\csname pgf@sh@ns@
#1\endcsname{rectangle
}
185 \expandafter\gdef\csname pgf@sh@np@
#1\endcsname{%
189 \pgfgettransform\pgf@temp
%
190 % once it is defined, no more transformations will be applied, I hope
191 \expandafter\xdef\csname pgf@sh@nt@
#1\endcsname{\pgf@temp
}%
192 \expandafter\xdef\csname pgf@sh@pi@
#1\endcsname{\pgfpictureid}%
196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
198 %% You may want to adapt the following to fit your needs (in your
199 %% individual style file and/or within your document).
203 % style for every plot
205 \tikzstyle{gnuplot
}=
[%
211 \tikzstyle{gp node left
}=
[anchor=mid west,yshift=-
.12ex
]
212 \tikzstyle{gp node center
}=
[anchor=mid,yshift=-
.12ex
]
213 \tikzstyle{gp node right
}=
[anchor=mid east,yshift=-
.12ex
]
215 % basic plot mark size (points)
223 % this is the default color for pattern backgrounds
224 \colorlet{gpbgfillcolor
}{white
}
227 % this should reverse the normal text node presets, for the
228 % later referencing as described below
229 \tikzstyle{gp refnode
}=
[coordinate,yshift=
.12ex
]
231 % to add an empty label with the referenceable name "my node"
232 % to the plot, just add the following line to your gnuplot
235 % set label "" at 1,1 font ",gp refnode,name=my node"
238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
240 %% The following TikZ-styles are derived from the 'pgf.styles.*' tables
241 %% in the Lua script.
242 %% To change the number of used styles you should change them there and
243 %% regenerate this style file.
246 % arrow styles settings
247 \tikzstyle{gp arrow
1} =
[>=latex
]
248 \tikzstyle{gp arrow
2} =
[>=angle
90]
249 \tikzstyle{gp arrow
3} =
[>=angle
60]
250 \tikzstyle{gp arrow
4} =
[>=angle
45]
251 \tikzstyle{gp arrow
5} =
[>=o
]
252 \tikzstyle{gp arrow
6} =
[>=*
]
253 \tikzstyle{gp arrow
7} =
[>=diamond
]
254 \tikzstyle{gp arrow
8} =
[>=open diamond
]
255 \tikzstyle{gp arrow
9} =
[>=
{]}]
256 \tikzstyle{gp arrow
10} =
[>=
{[}]
257 \tikzstyle{gp arrow
11} =
[>=)
]
258 \tikzstyle{gp arrow
12} =
[>=(
]
261 \tikzstyle{gp mark
0} =
[mark size=
.5\pgflinewidth,mark=*
]
262 \tikzstyle{gp mark
1} =
[mark=+
]
263 \tikzstyle{gp mark
2} =
[mark=x
]
264 \tikzstyle{gp mark
3} =
[mark=star
]
265 \tikzstyle{gp mark
4} =
[mark=square
]
266 \tikzstyle{gp mark
5} =
[mark=square*
]
267 \tikzstyle{gp mark
6} =
[mark=o
]
268 \tikzstyle{gp mark
7} =
[mark=*
]
269 \tikzstyle{gp mark
8} =
[mark=triangle
]
270 \tikzstyle{gp mark
9} =
[mark=triangle*
]
271 \tikzstyle{gp mark
10} =
[mark=triangle,mark options=
{rotate=
180}]
272 \tikzstyle{gp mark
11} =
[mark=triangle*,mark options=
{rotate=
180}]
273 \tikzstyle{gp mark
12} =
[mark=diamond
]
274 \tikzstyle{gp mark
13} =
[mark=diamond*
]
275 \tikzstyle{gp mark
14} =
[mark=otimes
]
276 \tikzstyle{gp mark
15} =
[mark=oplus
]
279 \tikzstyle{gp pattern
0} =
[white
]
280 \tikzstyle{gp pattern
1} =
[pattern=north east lines
]
281 \tikzstyle{gp pattern
2} =
[pattern=north west lines
]
282 \tikzstyle{gp pattern
3} =
[pattern=crosshatch
]
283 \tikzstyle{gp pattern
4} =
[pattern=grid
]
284 \tikzstyle{gp pattern
5} =
[pattern=vertical lines
]
285 \tikzstyle{gp pattern
6} =
[pattern=horizontal lines
]
286 \tikzstyle{gp pattern
7} =
[pattern=dots
]
287 \tikzstyle{gp pattern
8} =
[pattern=crosshatch dots
]
288 \tikzstyle{gp pattern
9} =
[pattern=fivepointed stars
]
289 \tikzstyle{gp pattern
10} =
[pattern=sixpointed stars
]
290 \tikzstyle{gp pattern
11} =
[pattern=bricks
]
292 % if the 'tikzplot' option is used the corresponding lines will be smoothed by default
293 \tikzstyle{gp plot axes
} =
[]%
294 \tikzstyle{gp plot border
} =
[]%
295 \tikzstyle{gp plot
0} =
[smooth
]%
296 \tikzstyle{gp plot
1} =
[smooth
]%
297 \tikzstyle{gp plot
2} =
[smooth
]%
298 \tikzstyle{gp plot
3} =
[smooth
]%
299 \tikzstyle{gp plot
4} =
[smooth
]%
300 \tikzstyle{gp plot
5} =
[smooth
]%
301 \tikzstyle{gp plot
6} =
[smooth
]%
302 \tikzstyle{gp plot
7} =
[smooth
]%
305 \tikzstyle{gp lt axes
} =
[dashed
]
306 \tikzstyle{gp lt border
} =
[solid
]
308 % linestyle "addon" settings for overwriting a default linestyle within the
309 % TeX document via eg. \tikzstyle{gp lt plot 1 add}=[fill=black,draw=none] etc.
310 \tikzstyle{gp lt axes add
} =
[]
311 \tikzstyle{gp lt border add
} =
[]
312 \tikzstyle{gp lt plot
0 add
} =
[]
313 \tikzstyle{gp lt plot
1 add
} =
[]
314 \tikzstyle{gp lt plot
2 add
} =
[]
315 \tikzstyle{gp lt plot
3 add
} =
[]
316 \tikzstyle{gp lt plot
4 add
} =
[]
317 \tikzstyle{gp lt plot
5 add
} =
[]
318 \tikzstyle{gp lt plot
6 add
} =
[]
319 \tikzstyle{gp lt plot
7 add
} =
[]
321 % linestyle color settings
322 \colorlet{gp lt
color axes
}{black
}
323 \colorlet{gp lt
color border
}{black
}
325 % command for switching to dashed lines
327 \tikzstyle{gp lt plot
0} =
[solid
]%
328 \tikzstyle{gp lt plot
1} =
[dashed
]%
329 \tikzstyle{gp lt plot
2} =
[dash pattern=on
1.5pt off
2.25pt
]%
330 \tikzstyle{gp lt plot
3} =
[dash pattern=on
\pgflinewidth off
1.125]%
331 \tikzstyle{gp lt plot
4} =
[dash pattern=on
4.5pt off
1.5pt on
\pgflinewidth off
1.5pt
]%
332 \tikzstyle{gp lt plot
5} =
[dash pattern=on
2.25pt off
2.25pt on
\pgflinewidth off
2.25pt
]%
333 \tikzstyle{gp lt plot
6} =
[dash pattern=on
1.5pt off
1.5pt on
1.5pt off
4.5pt
]%
334 \tikzstyle{gp lt plot
7} =
[dash pattern=on
\pgflinewidth off
1.5pt on
4.5pt off
1.5pt on
\pgflinewidth off
1.5pt
]%
337 % command for switching to colored lines
338 \def\gpcoloredlines{%
339 \colorlet{gp lt
color 0}{red
}%
340 \colorlet{gp lt
color 1}{green!
60!black
}%
341 \colorlet{gp lt
color 2}{blue
}%
342 \colorlet{gp lt
color 3}{magenta
}%
343 \colorlet{gp lt
color 4}{cyan
}%
344 \colorlet{gp lt
color 5}{orange
}%
345 \colorlet{gp lt
color 6}{yellow!
80!red
}%
346 \colorlet{gp lt
color 7}{blue!
80!black
}%
349 % command for switching to solid lines
351 \tikzstyle{gp lt plot
0} =
[solid
]%
352 \tikzstyle{gp lt plot
1} =
[solid
]%
353 \tikzstyle{gp lt plot
2} =
[solid
]%
354 \tikzstyle{gp lt plot
3} =
[solid
]%
355 \tikzstyle{gp lt plot
4} =
[solid
]%
356 \tikzstyle{gp lt plot
5} =
[solid
]%
357 \tikzstyle{gp lt plot
6} =
[solid
]%
358 \tikzstyle{gp lt plot
7} =
[solid
]%
361 % command for switching to monochrome (black) lines
362 \def\gpmonochromelines{%
363 \colorlet{gp lt
color 0}{black
}%
364 \colorlet{gp lt
color 1}{black
}%
365 \colorlet{gp lt
color 2}{black
}%
366 \colorlet{gp lt
color 3}{black
}%
367 \colorlet{gp lt
color 4}{black
}%
368 \colorlet{gp lt
color 5}{black
}%
369 \colorlet{gp lt
color 6}{black
}%
370 \colorlet{gp lt
color 7}{black
}%
374 % some initialisations
376 % by default all lines will be colored and dashed
380 \gpsetlinetype{gp lt solid
}