summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-02-05 01:37:03 +0000
committerKarl Berry <karl@freefriends.org>2008-02-05 01:37:03 +0000
commite1b4deff802f0013f051f9f07cc1a4ee6953d618 (patch)
treea5dd5504803239d09f4d17b0743e81640280fd7f /Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty
parentc7bf9c35539d4441af084e9b99d68ed6efa4f404 (diff)
pgfplots update (31jan08)
git-svn-id: svn://tug.org/texlive/trunk@6502 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty')
-rw-r--r--Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty228
1 files changed, 154 insertions, 74 deletions
diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty
index daf042622ee..394cf16be6d 100644
--- a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty
+++ b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty
@@ -23,8 +23,8 @@
% along with this program. If not, see <http://www.gnu.org/licenses/>.
%
%--------------------------------------------
-\def\pgfplotsversion{0.9}
-\ProvidesPackage{pgfplots}[2008/26/01 Version \pgfplotsversion]
+\def\pgfplotsversion{0.92}
+\ProvidesPackage{pgfplots}[2008/31/01 Version \pgfplotsversion]
\RequirePackage{xkeyval}[2006/11/18]
\RequirePackage{ifthen}
\RequirePackage{liststructure}
@@ -53,6 +53,7 @@
\def\axis@rightover{}
\def\axisdefaultwidth{240pt}
\def\axisdefaultheight{207pt}
+\def\axisdefaulttickwidth{35}% the maximum space between adjacent ticks (in pt, but don't specify the unit 'pt')
\listnew{\blackwhiteplotspeclist}{%
mark options={fill=gray},mark=*\\%
@@ -60,11 +61,11 @@
mark options={fill=gray},mark=otimes*\\%
mark=star\\%
mark options={fill=gray},mark=diamond*\\%
- loosely dashed,mark options={solid,fill=gray},mark=*\\%
- loosely dashed,mark options={solid,fill=gray},mark=square*\\%
- loosely dashed,mark options={solid,fill=gray},mark=otimes*\\%
- loosely dashed,mark options={solid},mark=star\\%
- loosely dashed,mark options={solid,fill=gray},mark=diamond*\\%
+ densely dashed,mark options={solid,fill=gray},mark=*\\%
+ densely dashed,mark options={solid,fill=gray},mark=square*\\%
+ densely dashed,mark options={solid,fill=gray},mark=otimes*\\%
+ densely dashed,mark options={solid},mark=star\\%
+ densely dashed,mark options={solid,fill=gray},mark=diamond*\\%
}
\listnew{\coloredplotspeclist}{%
blue,mark options={fill=blue!80!black},mark=*\\%
@@ -72,11 +73,11 @@
brown!60!black,mark options={fill=brown!80!black},mark=otimes*\\%
black,mark=star\\%
blue,mark options={fill=blue!80!black},mark=diamond*\\%
- red,loosely dashed,mark options={solid,fill=red!80!black},mark=*\\%
- brown!60!black,loosely dashed,mark options={solid,fill=brown!80!black},mark=square*\\%
- black,loosely dashed,mark options={solid,fill=gray},mark=otimes*\\%
- blue,loosely dashed,mark=star,mark options=solid\\%
- red,loosely dashed,mark options={solid,fill=red!80!black},mark=diamond*\\%
+ red,densely dashed,mark options={solid,fill=red!80!black},mark=*\\%
+ brown!60!black,densely dashed,mark options={solid,fill=brown!80!black},mark=square*\\%
+ black,densely dashed,mark options={solid,fill=gray},mark=otimes*\\%
+ blue,densely dashed,mark=star,mark options=solid\\%
+ red,densely dashed,mark options={solid,fill=red!80!black},mark=diamond*\\%
}
@@ -138,6 +139,7 @@
\tikzstyle{every axis label}=[]
\tikzstyle{every axis x label}=[at={(0.5,0)},below,yshift=-15pt]
\tikzstyle{every axis y label}=[at={(0,0.5)},xshift=-35pt,rotate=90]
+\tikzstyle{every axis title}=[at={(0.5,1)},above,yshift=6pt]
\tikzstyle{every tick}=[very thin,gray]
\tikzstyle{every minor tick}=[]
\tikzstyle{every tick label}=[]
@@ -192,6 +194,7 @@
subtickwidth,tickwidth,%
xfilter,yfilter,%
width,height,%
+ title,%
execute at begin plot,%
execute at end plot,%
x,y}%
@@ -262,6 +265,7 @@
tickpos=both,
xfilter=,
yfilter=,
+ title=,
width=,
height=,
subtickwidth=0.1cm,
@@ -310,26 +314,33 @@
}}
\newcommand{\axisdefaultticklabel}[0]{%
- $\tick$%
+ $\prettyprintnumber{\tick}$%
}
\newcommand{\axisdefaultticklabellog}[0]{%
- $10^{\logtologten\tick}$%
+ \logtologtentomacro{\tick}{\roundedtick}%
+ $10^{\prettyprintnumber{\roundedtick}}$%
}
-\newcommand{\showxlabel}{%
+\newcommand{\axisshowxlabel}{%
\node
[style=every axis label,%
style=every axis x label]
{\axis@xlabel};
+
}
-\newcommand{\showylabel}{%
+\newcommand{\axisshowylabel}{%
\node
[style=every axis label,
style=every axis y label]
{\axis@ylabel};
}
+\newcommand{\axisshowtitle}{%
+ \node%
+ [style=every axis title]
+ {\axis@title};
+}
% Y-Achsen und Achsenbeschriftung LOG:
% 1: Ticks
@@ -880,6 +891,12 @@
}%
}
+\def\logtologtentomacro#1#2{%
+ \pgfmathlog@invoke@expanded\pgfmathdivide@{{#1}{\logten}}%
+ \expandafter\skipsuffixzero\pgfmathresult|%
+ \let#2=\pgfmathresult
+}
+
% Expands to #1/log(10). It will also skip a suffix '.0'
\def\logtologten#1{%
\pgfmathlog@invoke@expanded\pgfmathdivide@{{#1}{\logten}}%
@@ -940,6 +957,103 @@
\fi
}
+% Computes tick positions using the current axis limits.
+%
+% Parameters:
+% \axisdefaulttickwidth
+% Determines the maximum space which is not filled by at least one
+% tick label (approximate, there is some rounding internally)
+%
+% Heuristics:
+% Set desirednumticks = trunc(ACTUAL WIDTH / axisdefaulttickwidth) +1
+%
+% and generate STEPSIZE = (axis range)/ desirednumticks
+%
+% We actually restrict STEPSIZE to { 1, 1/2, 1/5, 1/10 }
+%
+% PRECONDITION:
+% - limits are correct
+% - axis width/height is set correctly
+%
+% POSTCONDITION:
+% - Tick for axis #1 is assigned
+% - \ifaxis@needs@check@uniformtick is set
+\def\axis@assign@default@tick@foraxis#1{%
+ \begingroup
+ \let\desirednumticks=\c@pgf@countd
+ \let\Wr=\pgf@xc
+ \Wr=\csname axis@#1coordmaxTEX\endcsname
+ \advance\Wr by-\csname axis@#1coordminTEX\endcsname
+ % r = max place without ticks in pt -> choose desirednumticks >= W/r
+ \expandafter\expandafter\divide\Wr\axisdefaulttickwidth
+ \pgfmathsetcount{\desirednumticks}{\Wr}%
+ \advance\desirednumticks by1
+ \ifcase\csname axis@#1mode\endcsname
+ % compute tick := MIN-h,MIN,....,MAX+h
+ % where h is a determined step size and MIN and MAX are
+ % (truncated) axis limits.
+ %
+ % The MIN-h and MAX+h is to support compatibility with the
+ % enlargelimits option - there should be ticks in the
+ % enlarged place.
+ \pgfmathsetcount{\c@pgf@counta}{\csname axis@#1min\endcsname}%
+ %\pgfmathsetcount{\c@pgf@countb}{\csname axis@#1max\endcsname}%
+ \expandafter\ifdim\csname axis@#1min\endcsname pt<0pt
+ % the truncation round TOWARDS 0 which is not what I want.
+ \advance\c@pgf@counta by-1
+ \fi
+ \let\MINH=\pgf@xa
+ \let\H=\pgf@xb
+ \let\MAX=\axis@tmpa
+ \let\MIN=\axis@tmpb
+ % compute step size 'h':
+ \expandafter\MAX\csname axis@#1max\endcsname pt
+ \advance\MAX by0.001pt% avoid round errors
+ \expandafter\MIN\the\c@pgf@counta pt
+ \H=\MAX
+ \advance\H by-\MIN
+ \c@pgf@counta=\desirednumticks
+ \advance\c@pgf@counta by-1
+ \divide\H by\c@pgf@counta
+ %\message{Wr\the\Wr, desirednumticks=\the\desirednumticks, H=\the\H}%
+ \ifdim\H<0.10001pt
+ \H=0.1pt
+ \else
+ \ifdim\H<0.20001pt
+ \H=0.2pt
+ \else
+ \ifdim\H<0.5001pt
+ \H=0.5pt
+ \else
+ \H=1pt
+ \fi
+ \fi
+ \fi
+ %\message{final H=\the\H}%
+ \MINH=\MIN
+ \advance\MINH by\H
+ \xdef\axis@TMP{\pgf@sys@tonumber{\MIN},\pgf@sys@tonumber{\MINH},...,\pgf@sys@tonumber{\MAX}}%
+ \aftergroup\axis@needs@check@uniformtickfalse
+ \or
+ \expandafter\ifx\csname axis@#1tickten\endcsname\empty
+ % I want ticks at 10^k. So determine k_min and k_max.
+ \pgfmathsetcount{\c@pgf@counta}{\csname axis@#1min\endcsname/\logten-1}%
+ \pgfmathsetmacro{\tmp@min}{\c@pgf@counta*\logten}%
+ \pgfmathsetcount{\c@pgf@counta}{\csname axis@#1max\endcsname/\logten}%
+ \pgfmathsetmacro{\tmp@max}{\c@pgf@counta*\logten}%
+ \pgfmathadd\tmp@min\logten%
+ \xdef\axis@TMP{\tmp@min,\pgfmathresult,...,\tmp@max}%
+ \aftergroup\axis@needs@check@uniformtickfalse
+ \else
+ \edef\axis@TMP{\csname axis@#1tickten\endcsname}%
+ \expandafter\axis@compute@tick@times@logten\axis@TMP\to\axis@TMP
+ \aftergroup\axis@needs@check@uniformticktrue
+ \fi
+ \fi
+ \endgroup
+ \expandafter\let\csname axis@#1tick\endcsname=\axis@TMP
+ %\message{pgfplots.sty: #1tick set to \csname axis@#1tick\endcsname [#1mode=\the\csname axis@#1mode\endcsname, #1min=\csname axis@#1min\endcsname, #1max=\csname axis@#1max\endcsname].}%
+}
\def\axis@determinedefaultvalues{%
% NOTIZ:
@@ -1002,6 +1116,7 @@
\axis@enlarge@xlim
\axis@enlarge@ylim
\else
+ % FIXME : this here should be user-configurable!
\ifaxis@autocompute@xlim
\axis@enlarge@xlim
\fi
@@ -1009,7 +1124,9 @@
\axis@enlarge@ylim
\fi
\fi
-%
+ %
+ \axis@initsizes
+ %
\newif\ifaxis@xisuniform
\newif\ifaxis@yisuniform
\axis@xisuniformtrue
@@ -1017,32 +1134,7 @@
\newif\ifaxis@needs@check@uniformtick
\axis@needs@check@uniformticktrue
\ifx\axis@xtick\empty
- \begingroup
- \ifcase\axis@xmode
- \pgfmathsetcount{\c@pgf@counta}{\axis@xmin-1}%
- \edef\tmp@min{\the\c@pgf@counta}%
- \pgfmathsetcount{\c@pgf@counta}{\axis@xmax}%
- \edef\tmp@max{\the\c@pgf@counta}%
- \xdef\axis@TMP{\tmp@min,...,\tmp@max}%
- \aftergroup\axis@needs@check@uniformtickfalse
- \or
- \ifx\axis@xtickten\empty
- % I want ticks at 10^k. So determine k_min and k_max.
- \pgfmathsetcount{\c@pgf@counta}{\axis@xmin/\logten-1}%
- \pgfmathsetmacro{\tmp@min}{\c@pgf@counta*\logten}%
- \pgfmathsetcount{\c@pgf@counta}{\axis@xmax/\logten}%
- \pgfmathsetmacro{\tmp@max}{\c@pgf@counta*\logten}%
- \pgfmathadd\tmp@min\logten%
- \xdef\axis@TMP{\tmp@min,\pgfmathresult,...,\tmp@max}%
- \aftergroup\axis@needs@check@uniformtickfalse
- \else
- \expandafter\axis@compute@tick@times@logten\axis@xtickten\to\axis@TMP
- \aftergroup\axis@needs@check@uniformticktrue
- \fi
- \fi
- \endgroup
- \let\axis@xtick=\axis@TMP
- %\message{pgfplots.sty: xtick set to \axis@xtick [xmode=\the\axis@xmode].}%
+ \axis@assign@default@tick@foraxis{x}%
\fi
\ifaxis@needs@check@uniformtick
\ifnum\axis@xmode=1
@@ -1060,32 +1152,7 @@
%
\axis@needs@check@uniformticktrue
\ifx\axis@ytick\empty
- \begingroup
- \ifcase\axis@ymode
- \pgfmathsetcount{\c@pgf@counta}{\axis@ymin-1}%
- \edef\tmp@min{\the\c@pgf@counta}%
- \pgfmathsetcount{\c@pgf@counta}{\axis@ymax}%
- \edef\tmp@max{\the\c@pgf@counta}%
- \xdef\axis@TMP{\tmp@min,...,\tmp@max}%
- \aftergroup\axis@needs@check@uniformtickfalse
- \or
- \ifx\axis@ytickten\empty
- % I want ticks at 10^k. So determine k_min and k_max.
- \pgfmathsetcount{\c@pgf@counta}{\axis@ymin/\logten-1}%
- \pgfmathsetmacro{\tmp@min}{\c@pgf@counta*\logten}%
- \pgfmathsetcount{\c@pgf@counta}{\axis@ymax/\logten}%
- \pgfmathsetmacro{\tmp@max}{\c@pgf@counta*\logten}%
- \pgfmathadd\tmp@min\logten%
- \xdef\axis@TMP{\tmp@min,\pgfmathresult,...,\tmp@max}%
- \aftergroup\axis@needs@check@uniformtickfalse
- \else
- \expandafter\axis@compute@tick@times@logten\axis@ytickten\to\axis@TMP
- \aftergroup\axis@needs@check@uniformticktrue
- \fi
- \fi
- \endgroup
- \let\axis@ytick=\axis@TMP
- %\message{pgfplots.sty: ytick set to \axis@ytick[ymode=\the\axis@ymode.}%
+ \axis@assign@default@tick@foraxis{y}%
\fi
\ifaxis@needs@check@uniformtick
\ifnum\axis@ymode=1
@@ -1187,6 +1254,10 @@
%--------------------------------------------------
}
+% PRECONDITION: correct axis limits
+% POSTCONDITION: the current x- and y unit vectors are changed;
+% \axis@[xy]coord{min,max}TEX are set
+%
\def\axis@initsizes{%
% INIT.
%
@@ -1341,7 +1412,6 @@
\def\axis@BEGIN@init@and@draw@axis{%
\axis@determinedefaultvalues
- \axis@initsizes
% X-Achsenbeschriftung:
% LADE DIE \axis@xtick -variable REIN
@@ -1428,12 +1498,12 @@
% any user-specified axis limits:
\ifx\axis@ymin\empty
\else
- \pgfmathlog@\expandafter{\axis@ymin}%
+ \expandafter\pgfmathlog@\expandafter{\axis@ymin}%
\let\axis@ymin=\pgfmathresult
\fi
\ifx\axis@ymax\empty
\else
- \pgfmathlog@\expandafter{\axis@ymax}%
+ \expandafter\pgfmathlog@\expandafter{\axis@ymax}%
\let\axis@ymax=\pgfmathresult
\fi
%
@@ -1552,8 +1622,18 @@
x={\axis@xcoordmaxTEX-\axis@xcoordminTEX},
y={\axis@ycoordmaxTEX-\axis@ycoordminTEX}
]%
- \showxlabel
- \showylabel
+ \ifx\axis@xlabel\empty
+ \else
+ \axisshowxlabel
+ \fi
+ \ifx\axis@ylabel\empty
+ \else
+ \axisshowylabel
+ \fi
+ \ifx\axis@title\empty
+ \else
+ \axisshowtitle
+ \fi
\axis@createlegend
\end{scope}%
%