Blob Blame History Raw
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%     Common style file for TeX, LaTeX and ConTeXt
%%  
%%  It is associated with the 'gnuplot.lua' script, and usually generated
%%  automatically. So take care whenever you make any changes!
%%

% check for the correct TikZ version
\def\gpchecktikzversion#1.#2\relax{%
\ifnum#1<2%
  \errmessage{PGF/TikZ version >= 2.0 is required!}%
\fi}
\expandafter\gpchecktikzversion\pgfversion\relax

% FIXME: is there a more elegant way to determine the output format?

\def\pgfsysdriver@a{pgfsys-dvi.def}       % ps
\def\pgfsysdriver@b{pgfsys-dvipdfm.def}   % pdf
\def\pgfsysdriver@c{pgfsys-dvipdfmx.def}  % pdf
\def\pgfsysdriver@d{pgfsys-dvips.def}     % ps
\def\pgfsysdriver@e{pgfsys-pdftex.def}    % pdf
\def\pgfsysdriver@f{pgfsys-tex4ht.def}    % html
\def\pgfsysdriver@g{pgfsys-textures.def}  % ps
\def\pgfsysdriver@h{pgfsys-vtex.def}      % ps
\def\pgfsysdriver@i{pgfsys-xetex.def}     % pdf

\newif\ifgppdfout\gppdfoutfalse
\newif\ifgppsout\gppsoutfalse

\ifx\pgfsysdriver\pgfsysdriver@a
  \gppsouttrue
\else\ifx\pgfsysdriver\pgfsysdriver@b
  \gppdfouttrue
\else\ifx\pgfsysdriver\pgfsysdriver@c
  \gppdfouttrue
\else\ifx\pgfsysdriver\pgfsysdriver@d
  \gppsouttrue
\else\ifx\pgfsysdriver\pgfsysdriver@e
  \gppdfouttrue
\else\ifx\pgfsysdriver\pgfsysdriver@f
  % tex4ht
\else\ifx\pgfsysdriver\pgfsysdriver@g
  \gppsouttrue
\else\ifx\pgfsysdriver\pgfsysdriver@h
  \gppsouttrue
\else\ifx\pgfsysdriver\pgfsysdriver@i
  \gppdfouttrue
\fi\fi\fi\fi\fi\fi\fi\fi\fi

% uncomment the following lines to make font values "appendable"
% and if you are really sure about that ;-)
% \pgfkeyslet{/tikz/font/.@cmd}{\undefined}
% \tikzset{font/.initial={}}
% \def\tikz@textfont{\pgfkeysvalueof{/tikz/font}}

%
% image related stuff
%
\def\gp@rawimage@pdf#1#2#3#4#5#6{%
  \def\gp@tempa{cmyk}%
  \def\gp@tempb{#1}%
  \ifx\gp@tempa\gp@tempb%
    \def\gp@temp{/CMYK}%
  \else%
    \def\gp@temp{/RGB}%
  \fi%
  \pgf@sys@bp{#4}\pgfsysprotocol@literalbuffered{0 0}\pgf@sys@bp{#5}%
  \pgfsysprotocol@literalbuffered{0 0 cm}%
  \pgfsysprotocol@literalbuffered{BI /W #2 /H #3 /CS \gp@temp}%
  \pgfsysprotocol@literalbuffered{/BPC 8 /F /AHx ID}%
  \pgfsysprotocol@literal{#6 > EI}%
}
\def\gp@rawimage@ps#1#2#3#4#5#6{%
  \def\gp@tempa{cmyk}%
  \def\gp@tempb{#1}%
  \ifx\gp@tempa\gp@tempb%
    \def\gp@temp{4}%
  \else%
    \def\gp@temp{3}%
  \fi%
  \pgfsysprotocol@literalbuffered{0 0 translate}%
  \pgf@sys@bp{#4}\pgf@sys@bp{#5}\pgfsysprotocol@literalbuffered{scale}%
  \pgfsysprotocol@literalbuffered{#2 #3 8 [#2 0 0 -#3 0 #3]}%
  \pgfsysprotocol@literalbuffered{currentfile /ASCIIHexDecode filter}%
  \pgfsysprotocol@literalbuffered{false \gp@temp\space colorimage}%
  \pgfsysprotocol@literal{#6 >}%
}
\def\gp@rawimage@html#1#2#3#4#5#6{%
% FIXME: print a warning message here
}

\ifgppdfout
  \def\gp@rawimage{\gp@rawimage@pdf}
\else
  \ifgppsout
    \def\gp@rawimage{\gp@rawimage@ps}
  \else
    \def\gp@rawimage{\gp@rawimage@html}
  \fi
\fi


\def\gploadimage#1#2#3#4#5{%
  \pgftext[left,bottom,x=#1cm,y=#2cm] {\pgfimage[interpolate=false,width=#3cm,height=#4cm]{#5}};%
}

\def\gp@set@size#1{%
  \def\gp@image@size{#1}%
}

\def\gp@rawimage@#1#2#3#4#5#6#7#8{
  \tikz@scan@one@point\gp@set@size(#6,#7)\relax%
  \tikz@scan@one@point\pgftransformshift(#2,#3)\relax%
  \pgftext {%
    \pgfsys@beginpurepicture%
    \gp@image@size% fill \pgf@x and \pgf@y
    \gp@rawimage{#1}{#4}{#5}{\pgf@x}{\pgf@y}{#8}%
    \pgfsys@endpurepicture%
  }%
}

%% \gprawimage{color model}{xcoord}{ycoord}{# of xpixel}{# of ypixel}{xsize}{ysize}{rgb/cmyk hex data RRGGBB/CCMMYYKK ...}{file name}
%% color model is 'cmyk' or 'rgb' (default)
\def\gprawimage#1#2#3#4#5#6#7#8#9{%
  \ifx&#9&%
    \gp@rawimage@{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}
  \else
    \ifgppsout
      \gp@rawimage@{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}
    \else
      \gploadimage{#2}{#3}{#6}{#7}{#9}
    \fi
  \fi
}

%
% gnuplottex comapatibility
% (see http://www.ctan.org/tex-archive/help/Catalogue/entries/gnuplottex.html)
%

\def\gnuplottexextension@lua{\string tex}
\def\gnuplottexextension@tikz{\string tex}

%
% gnuplot variables getter and setter
%

\def\gpsetvar#1#2{%
  \expandafter\xdef\csname gp@var@#1\endcsname{#2}
}

\def\gpgetvar#1{%
  \csname gp@var@#1\endcsname %
}

%
% some wrapper code
%

% short for a filled path
\def\gpfill#1{\path[line width=0.1\gpbaselw,draw,fill,#1]}

% short for changing the line width
\def\gpsetlinewidth#1{\pgfsetlinewidth{#1\gpbaselw}}

% short for changing the line type
\def\gpsetlinetype#1{\tikzset{gp path/.style={#1,#1 add}}}

% short for changing the dash pattern
\def\gpsetdashtype#1{\tikzset{gp path/.append style={#1}}}

% short for changing the point size
\def\gpsetpointsize#1{\tikzset{gp point/.style={mark size=#1\gpbasems}}}

% wrapper for color settings
\def\gpcolor#1{\tikzset{global #1}}
\tikzset{rgb color/.code={\pgfutil@definecolor{.}{rgb}{#1}\tikzset{color=.}}}
\tikzset{global rgb color/.code={\pgfutil@definecolor{.}{rgb}{#1}\pgfutil@color{.}}}
\tikzset{global color/.code={\pgfutil@color{#1}}}

% prevent plot mark distortions due to changes in the PGF transformation matrix
% use `\gpscalepointstrue' and `\gpscalepointsfalse' for enabling and disabling
% point scaling
%
\newif\ifgpscalepoints
\tikzset{gp shift only/.style={%
  \ifgpscalepoints\else shift only\fi%
}}
\def\gppoint#1#2{%
  \path[solid] plot[only marks,gp point,mark options={gp shift only},#1] coordinates {#2};%
}


%
% char size calculation, that might be used with gnuplottex
%
% Example code (needs gnuplottex.sty):
%
%    % calculate the char size when the "gnuplot" style is used
%    \tikzset{gnuplot/.append style={execute at begin picture=\gpcalccharsize}}
%
%    \tikzset{gnuplot/.append style={font=\ttfamily\footnotesize}}
%
%    \begin{tikzpicture}[gnuplot]
%      \begin{gnuplot}[terminal=lua,%
%          terminaloptions={tikz solid nopic charsize \the\gphcharsize,\the\gpvcharsize}]
%        test
%      \end{gnuplot}
%    \end{tikzpicture}
%
%%%
% The `\gpcalccharsize' command fills the lengths \gpvcharsize and \gphcharsize with
% the values of the current default font used within nodes and is meant to be called
% within a tikzpicture environment.
% 
\newdimen\gpvcharsize
\newdimen\gphcharsize
\def\gpcalccharsize{%
  \pgfinterruptboundingbox%
  \pgfsys@begininvisible%
  \node at (0,0) {%
    \global\gphcharsize=1.05\fontcharwd\font`0%
    \global\gpvcharsize=1.05\fontcharht\font`0%
    \global\advance\gpvcharsize by 1.05\fontchardp\font`g%
  };%
  \pgfsys@endinvisible%
  \endpgfinterruptboundingbox%
}

%
%  define a rectangular node in tikz e.g. for the plot area
%
%  #1 node name
%  #2 coordinate of "south west"
%  #3 coordinate of "north east"
%
\def\gpdefrectangularnode#1#2#3{%
  \expandafter\gdef\csname pgf@sh@ns@#1\endcsname{rectangle}
  \expandafter\gdef\csname pgf@sh@np@#1\endcsname{%
    \def\southwest{#2}%
    \def\northeast{#3}%
  }
  \pgfgettransform\pgf@temp%
  % once it is defined, no more transformations will be applied, I hope
  \expandafter\xdef\csname pgf@sh@nt@#1\endcsname{\pgf@temp}%
  \expandafter\xdef\csname pgf@sh@pi@#1\endcsname{\pgfpictureid}%
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%  You may want to adapt the following to fit your needs (in your 
%%  individual style file and/or within your document).
%%

%
% style for every plot
%
\tikzset{gnuplot/.style={%
  >=stealth',%
  line cap=round,%
  line join=round,%
}}

\tikzset{gp node left/.style={anchor=mid west,yshift=-.12ex}}
\tikzset{gp node center/.style={anchor=mid,yshift=-.12ex}}
\tikzset{gp node right/.style={anchor=mid east,yshift=-.12ex}}

% basic plot mark size (points)
\newdimen\gpbasems
\gpbasems=.4pt

% basic linewidth
\newdimen\gpbaselw
\gpbaselw=.4pt

% this is the default color for pattern backgrounds
\colorlet{gpbgfillcolor}{white}

% set background color and fill color
\def\gpsetbgcolor#1{%
  \pgfutil@definecolor{gpbgfillcolor}{rgb}{#1}%
  \tikzset{tight background,background rectangle/.style={fill=gpbgfillcolor},show background rectangle}%
}

% this should reverse the normal text node presets, for the
% later referencing as described below
\tikzset{gp refnode/.style={coordinate,yshift=.12ex}}

% to add an empty label with the referenceable name "my node"
% to the plot, just add the following line to your gnuplot
% file:
%
% set label "" at 1,1 font ",gp refnode,name=my node"
%

% enlargement of the bounding box in standalone mode (only used by LaTeX/ConTeXt)
\def\gpbboxborder{0mm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%  The following TikZ-styles are derived from the 'pgf.styles.*' tables
%%  in the Lua script.
%%  To change the number of used styles you should change them there and
%%  regenerate this style file.
%%

% arrow styles settings
\tikzset{gp arrow 1/.style={>=latex}}
\tikzset{gp arrow 2/.style={>=angle 90}}
\tikzset{gp arrow 3/.style={>=angle 60}}
\tikzset{gp arrow 4/.style={>=angle 45}}
\tikzset{gp arrow 5/.style={>=o}}
\tikzset{gp arrow 6/.style={>=*}}
\tikzset{gp arrow 7/.style={>=diamond}}
\tikzset{gp arrow 8/.style={>=open diamond}}
\tikzset{gp arrow 9/.style={>={]}}}
\tikzset{gp arrow 10/.style={>={[}}}
\tikzset{gp arrow 11/.style={>=)}}
\tikzset{gp arrow 12/.style={>=(}}

% plotmark settings
\tikzset{gp mark 0/.style={mark size=.5\pgflinewidth,mark=*}}
\tikzset{gp mark 1/.style={mark=+}}
\tikzset{gp mark 2/.style={mark=x}}
\tikzset{gp mark 3/.style={mark=star}}
\tikzset{gp mark 4/.style={mark=square}}
\tikzset{gp mark 5/.style={mark=square*}}
\tikzset{gp mark 6/.style={mark=o}}
\tikzset{gp mark 7/.style={mark=*}}
\tikzset{gp mark 8/.style={mark=triangle}}
\tikzset{gp mark 9/.style={mark=triangle*}}
\tikzset{gp mark 10/.style={mark=triangle,every mark/.append style={rotate=180}}}
\tikzset{gp mark 11/.style={mark=triangle*,every mark/.append style={rotate=180}}}
\tikzset{gp mark 12/.style={mark=diamond}}
\tikzset{gp mark 13/.style={mark=diamond*}}
\tikzset{gp mark 14/.style={mark=otimes}}
\tikzset{gp mark 15/.style={mark=oplus}}

% pattern settings
\tikzset{gp pattern 0/.style={white}}
\tikzset{gp pattern 1/.style={pattern=north east lines}}
\tikzset{gp pattern 2/.style={pattern=north west lines}}
\tikzset{gp pattern 3/.style={pattern=crosshatch}}
\tikzset{gp pattern 4/.style={pattern=grid}}
\tikzset{gp pattern 5/.style={pattern=vertical lines}}
\tikzset{gp pattern 6/.style={pattern=horizontal lines}}
\tikzset{gp pattern 7/.style={pattern=dots}}
\tikzset{gp pattern 8/.style={pattern=crosshatch dots}}
\tikzset{gp pattern 9/.style={pattern=fivepointed stars}}
\tikzset{gp pattern 10/.style={pattern=sixpointed stars}}
\tikzset{gp pattern 11/.style={pattern=bricks}}

% if the 'tikzplot' option is used the corresponding lines will be smoothed by default
\tikzset{gp plot axes/.style=}
\tikzset{gp plot border/.style=}
\tikzset{gp plot 0/.style=smooth}
\tikzset{gp plot 1/.style=smooth}
\tikzset{gp plot 2/.style=smooth}
\tikzset{gp plot 3/.style=smooth}
\tikzset{gp plot 4/.style=smooth}
\tikzset{gp plot 5/.style=smooth}
\tikzset{gp plot 6/.style=smooth}
\tikzset{gp plot 7/.style=smooth}

% linestyle settings
\tikzset{gp lt axes/.style=dotted}
\tikzset{gp lt border/.style=solid}

% linestyle "addon" settings for overwriting a default linestyle within the
% TeX document via eg. \tikzset{gp lt plot 1 add/.style={fill=black,draw=none}} etc.
\tikzset{gp lt axes add/.style={}}
\tikzset{gp lt border add/.style={}}
\tikzset{gp lt plot 0 add/.style={}}
\tikzset{gp lt plot 1 add/.style={}}
\tikzset{gp lt plot 2 add/.style={}}
\tikzset{gp lt plot 3 add/.style={}}
\tikzset{gp lt plot 4 add/.style={}}
\tikzset{gp lt plot 5 add/.style={}}
\tikzset{gp lt plot 6 add/.style={}}
\tikzset{gp lt plot 7 add/.style={}}
\tikzset{gp lt plot 0/.style={}}
\tikzset{gp lt plot 1/.style={}}
\tikzset{gp lt plot 2/.style={}}
\tikzset{gp lt plot 3/.style={}}
\tikzset{gp lt plot 4/.style={}}
\tikzset{gp lt plot 5/.style={}}
\tikzset{gp lt plot 6/.style={}}
\tikzset{gp lt plot 7/.style={}}

% linestyle color settings
\colorlet{gp lt color axes}{black!30}
\colorlet{gp lt color border}{black}

% dash type settings
% Define this as a macro so that the dash patterns expand later with the current \pgflinewidth.
\def\gpdashlength{\pgflinewidth}
\tikzset{gp dt 0/.style={solid}}
\tikzset{gp dt 1/.style={solid}}
\tikzset{gp dt 2/.style={dash pattern=on 7.5*\gpdashlength off 7.5*\gpdashlength}}
\tikzset{gp dt 3/.style={dash pattern=on 3.75*\gpdashlength off 5.625*\gpdashlength}}
\tikzset{gp dt 4/.style={dash pattern=on 1*\gpdashlength off 2.8125*\gpdashlength}}
\tikzset{gp dt 5/.style={dash pattern=on 11.25*\gpdashlength off 3.75*\gpdashlength on 1*\gpdashlength off 3.75*\gpdashlength}}
\tikzset{gp dt 6/.style={dash pattern=on 5.625*\gpdashlength off 5.625*\gpdashlength on 1*\gpdashlength off 5.625*\gpdashlength}}
\tikzset{gp dt 7/.style={dash pattern=on 3.75*\gpdashlength off 3.75*\gpdashlength on 3.75*\gpdashlength off 11.25*\gpdashlength}}
\tikzset{gp dt 8/.style={dash pattern=on 1*\gpdashlength off 3.75*\gpdashlength on 11.25*\gpdashlength off 3.75*\gpdashlength on 1*\gpdashlength off 3.75*\gpdashlength}}
\tikzset{gp dt solid/.style={solid}}
\tikzset{gp dt axes/.style={dotted}}

% command for switching to colored lines
\def\gpcoloredlines{%
  \colorlet{gp lt color 0}{red}%
  \colorlet{gp lt color 1}{green}%
  \colorlet{gp lt color 2}{blue}%
  \colorlet{gp lt color 3}{magenta}%
  \colorlet{gp lt color 4}{cyan}%
  \colorlet{gp lt color 5}{yellow}%
  \colorlet{gp lt color 6}{orange}%
  \colorlet{gp lt color 7}{purple}%
}

% command for switching to monochrome (black) lines
\def\gpmonochromelines{%
  \colorlet{gp lt color 0}{black}%
  \colorlet{gp lt color 1}{black}%
  \colorlet{gp lt color 2}{black}%
  \colorlet{gp lt color 3}{black}%
  \colorlet{gp lt color 4}{black}%
  \colorlet{gp lt color 5}{black}%
  \colorlet{gp lt color 6}{black}%
  \colorlet{gp lt color 7}{black}%
}

%
% some initialisations
%
% by default all lines will be colored
\gpcoloredlines
\gpsetpointsize{4}
\gpsetlinetype{gp lt solid}
\gpscalepointsfalse
\endinput