Skip to content

Commit

Permalink
- scatter will now assign a mark if none is set.
Browse files Browse the repository at this point in the history
- empty plot bug has been fixed.
- using xmode in wrong context leads to error message.
- xticklabel pos now accepts 'top' and 'bottom'
- manual has more compact index: I removed the '/pgfplots/' and '/tikz/'
collections.
- improved index formatting.
- re-implemented plot expression's sampling method. The PGF \foreach
statement does not allow sampling domains beyond PGF's native math parser,
the new implementation does also support the 'fp' package (combinded with
the associated PGF library).
Efficiency is expected to be higher than the previous \foreach
implementation.
- Provided a specialized processing of the |domain| argument for plot
function which avoids the pgf math parser. Now, plot function provides the
full data range of gnuplot.
  • Loading branch information
ludewich committed Dec 6, 2008
1 parent becec77 commit 063bebf
Show file tree
Hide file tree
Showing 10 changed files with 590 additions and 123 deletions.
20 changes: 20 additions & 0 deletions doc/latex/pgfplots/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
2008-12-06 Christian Feuersaenger <ludewich@users.sourceforge.net>

- scatter will now assign a mark if none is set.
- empty plot bug has been fixed.
- using xmode in wrong context leads to error message.
- xticklabel pos now accepts 'top' and 'bottom'
- manual has more compact index: I removed the '/pgfplots/' and '/tikz/'
collections.
- improved index formatting.
- re-implemented plot expression's sampling method. The PGF \foreach
statement does not allow sampling domains beyond PGF's native math parser,
the new implementation does also support the 'fp' package (combinded with
the associated PGF library).
Efficiency is expected to be higher than the previous \foreach
implementation.
- Provided a specialized processing of the |domain| argument for plot
function which avoids the pgf math parser. Now, plot function provides the
full data range of gnuplot.


2008-12-05 Christian Feuersaenger <ludewich@users.sourceforge.net>

- improved sanity checking for plot coordinate syntax; empty lines in plot
Expand Down
20 changes: 17 additions & 3 deletions doc/latex/pgfplots/pgfmanual-en-macros.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.

% $Header: /cvsroot/pgfplots/pgfplots/doc/latex/pgfplots/pgfmanual-en-macros.tex,v 1.1 2008/05/24 12:09:27 ludewich Exp $
% $Header: /cvsroot/pgfplots/pgfplots/doc/latex/pgfplots/pgfmanual-en-macros.tex,v 1.2 2008/12/06 19:47:33 ludewich Exp $


% This file is part of the pgf manual; I re-use it here with
% permission.
%
% I have changed very few things (marked with 'CF')

\providecommand\href[2]{\texttt{#1}}


Expand Down Expand Up @@ -282,8 +287,17 @@
\def\myname{#1}%
\else%
\iffirsttime
\def\mypath{#1@\protect\texttt{/#1/}!}%
\firsttimefalse
% CF : disabled for /pgfplots/ prefix.
% \def\mypath{#1@\protect\texttt{/#1/}!}%
% \firsttimefalse
\def\pgfplotslocTMPa{pgfplots}%
\edef\pgfplotslocTMPb{#1}%
\ifx\pgfplotslocTMPb\pgfplotslocTMPa
\def\mypath{}%
\else
\def\mypath{#1@\protect\texttt{/#1/}!}%
\fi
\firsttimefalse
\else
\expandafter\def\expandafter\mypath\expandafter{\mypath#1@\protect\texttt{#1/}!}%
\fi
Expand Down
23 changes: 22 additions & 1 deletion doc/latex/pgfplots/pgfplots.preamble.tex
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[a4paper]{ltxdoc}

\usepackage{makeidx}

% DON't let hyperref overload the format of index and glossary.
% I want to do that on my own in the stylefiles for makeindex...
\makeatletter
\let\@old@wrindex=\@wrindex
\makeatother

\usepackage{ifpdf}
\ifpdf
Expand All @@ -30,6 +37,16 @@
\fi
\hypersetup{pdfborder={0 0 0}}

\makeatletter
\let\@wrindex=\@old@wrindex
\makeatother

% Formatiere Seitennummern im Index:
\newcommand{\indexpageno}[1]{%
{\bfseries\hyperpage{#1}}%
}


\newcommand{\R}{\mathbb{R}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
Expand Down Expand Up @@ -65,13 +82,17 @@
\usetikzlibrary{pgfplotsclickable}
\fi

\usepackage{fp}
% ATTENTION:
% this requires pgf version NEWER than 2.00 :
\usetikzlibrary{fixedpointarithmetic}

\usetikzlibrary{dateplot}

\usepackage[a4paper,left=2.25cm,right=2.25cm,top=2.5cm,bottom=2.5cm,nohead]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{xxcolor}
\usepackage{pifont}
\usepackage{makeidx}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{eurosym}
Expand Down
64 changes: 59 additions & 5 deletions doc/latex/pgfplots/pgfplots.reference.tex
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ \subsection{The Plot Command}
\item For normal plots, \PGFPlots\ applies floating point arithmetics to support large or small numbers like 0.00000001234 or $1.234\cdot 10^{24}$. Its number range is much larger than \TeX's native support for numbers. The relative precision is at least~$5$ significant decimal digits for the mantisse. As soon as the axes limits are completely known, \PGFPlots\ applies a transformation which maps these floating point numbers into \TeX-precision using transformations
\[ T_x(x) = 10^{s_x} \cdot x - a_x \text{ and } T_y(y) = 10^{s_y} \cdot y - a_y \]
with properly chosen integers $s_x, s_y \in \Z$ and shifts $a_x,a_y\in \R$. Section~\ref{sec:disabledatascaling} contains a description of |disabledatascaling| and provides more details about the transformation.
\index{Accuracy!Floating Point in \PGFPlots}%

\item As a consequence of the coordinate parsing routines, you can't use the mathematical expression parsing method of \PGF\ as coordinates (that means: you will need to provide coordinates without suffixes like ``cm'' or ``pt'' and you can't invoke mathematical functions).

Expand Down Expand Up @@ -371,6 +372,10 @@ \subsubsection{Providing Input Coordinates}
The \meta{style options} determine the appearance of the plotted function; these parameters also affect the legend. The \meta{behavior options} are specific to the gnuplot interface. These options are described in all detail in \cite[section~18.6]{tikz}. A short summary is shown below.
Please note that |plot function| does not allow per point meta data.
\paragraph{High precision for \normalfont\texttt{domain}}
\index{Accuracy!High Precision for Gnuplot Domains}%
Please supply the |domain| key always as \meta{behavior option} to |\addplot| (not as global option to |axis| or |tikzpicture|). This ensures that you can use the full floating point data range of |gnuplot| for |domain|.
\end{addplotoperation}
\begin{key}{/tikz/domain=\meta{start}:\meta{end} (initially [-5:5])}
Expand Down Expand Up @@ -431,6 +436,49 @@ \subsubsection{Providing Input Coordinates}
to convert the radians to degrees. The \Tikz\ plot expression parser also accepts some more options like |samples at=|\marg{coordinate list} or |variable=\t| which are described in the \Tikz\ manual.
Please note that plot expression does not allow per point meta data.
\paragraph{Accuracy}
\index{Accuracy!High Precision for Plot Expression}%
\index{Error Messages!dimension too large}%
The accuracy of plot expression is limited to that of \PGF's math parser. The standard parser employs \TeX's fast register arithmetics for all its computations which is limited to data ranges of $\pm 16384.0$ and $0.0001$ absolute minimum. For many applications, this is sufficient. If it is \emph{not} sufficient, there are two possibilities:
\begin{enumerate}
\item Use |plot function|. It uses the external, freely available program |gnuplot| as desktop calculator. \PGFPlots\ as such is capabable of handling large numbers with reasonable accuracy.
\item Change the \PGF\ math parser. At the time of this writing, this requires the CVS version of \PGF\ (that's why I did not already include it as default into \PGFPlots).
\end{enumerate}
Just in case your version of \PGF\ already contains the |fixedpointarithmetic| library, the following example shows how to get higher accuracy.
\begin{codeexample}[]
\begin{tikzpicture}
\begin{loglogaxis}[
samples=150,
title={$\frac{1}{x^2}$
with \PGF's math parser}]
\addplot[blue]
[domain=1:1000]
(\x,\x^-2);
\end{loglogaxis}
\end{tikzpicture}
\end{codeexample}
\noindent Since we have a logarithmic scale, we expect $\log x^{-2} = -2 \log x$ to be a straight line. The example above clearly shows limitations of the standard configuration. If you have a recent \PGF\ version (at the time of this writing, this refers to the CVS version of \PGF!), it is possible to use the fixed point library of \PGF:
\begin{codeexample}[]
% Requires:
% \usepackage{fp}
% \usetikzlibrary{fixedpointarithmetic}
% WARNING:
% At the time of this writing,
% this library is only available in
% the CVS version of pgf!
\begin{tikzpicture}
\begin{loglogaxis}[
samples=150,
title={$\frac{1}{x^2}$ with
\PGF's fixed point library}]
\addplot[blue]
[fixed point arithmetic,domain=1:100000]
(\x,\x^-2);
\end{loglogaxis}
\end{tikzpicture}
\end{codeexample}
\noindent Please note, however, that |fp| is relatively slow. It may be faster to use |plot function| which invokes |gnuplot| and leads to the same result.
\end{addplotoperation}
\begin{command}{\addplot+\oarg{style options} \textcolor{gray}{\dots};}
Expand Down Expand Up @@ -2052,7 +2100,8 @@ \subsubsection{Options Controlling Linestyles}
red!70!white,mark=star\\%
lime!80!black,every mark/.append style={fill=lime},mark=diamond*\\%
red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=*\\%
yellow!60!black,densely dashed,every mark/.append style={solid,fill=yellow!80!black},mark=square*\\%
yellow!60!black,densely dashed,
every mark/.append style={solid,fill=yellow!80!black},mark=square*\\%
black,every mark/.append style={solid,fill=gray},mark=otimes*\\%
blue,densely dashed,mark=star,every mark/.append style=solid\\%
red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=diamond*\\%
Expand Down Expand Up @@ -3382,6 +3431,7 @@ \subsection{Specifying the Plotted Range}
\end{stylekey}
\begin{environment}{{pgfplotsinterruptdatabb}}
\index{Bounding Box Control!Disable \protect\emph{data} bounding box modifications}
Everything in \marg{environment contents} will not contribute to the data bounding box.
\end{environment}
Expand Down Expand Up @@ -3764,7 +3814,7 @@ \subsection{Tick and Grid Options}
\begin{pgfplotsxykeylist}{
scaled \x\ ticks=\mchoice{true,false,base 10:{\normalfont\meta{e}},real:{\normalfont\meta{number}},manual:{\normalfont\marg{text}\marg{tick scale code}}} (initially true),
scaled ticks=\mchoice{true,false,base 10:{\normalfont\meta{e}},real:{\normalfont\meta{number}},manual:{\normalfont\marg{text}\marg{tick scale code}\hfill}} (initially true)}
Allows to factor out common exponents in tick labels. For example, if you have tick labels $20000,40000$ and $60000$, you may want to save some space and write $2,4,6$ with a separate factor `$\cdot 10^4$'. Use `|scaled ticks=true|' to enable this feature. In case |true|, tick scaling will be triggered if the data range is either too large or too small (see below).
Allows to factor out common exponents in tick labels for \emph{linear axes}. For example, if you have tick labels $20000,40000$ and $60000$, you may want to save some space and write $2,4,6$ with a separate factor `$\cdot 10^4$'. Use `|scaled ticks=true|' to enable this feature. In case |true|, tick scaling will be triggered if the data range is either too large or too small (see below).
\begin{codeexample}[]
\begin{tikzpicture}
\begin{axis}[scaled ticks=true]
Expand Down Expand Up @@ -3869,6 +3919,8 @@ \subsection{Tick and Grid Options}
This feature may also be used do transform coordinates in case they can't be processed with \PGFPlots: transform them and supply a proper tick scaling method such that tick labels represent the original range.
If \marg{text} is empty, the tick scale label won't be drawn (and no space will be occupied).
Tick scaling does \emph{not} work for logarithmic axes.
\end{pgfplotsxykeylist}
\begin{pgfplotsxycodekeylist}{\x tick scale label code}
Expand Down Expand Up @@ -3912,7 +3964,7 @@ \subsection{Tick and Grid Options}
\begin{pgfplotsxykey}{\x ticklabel pos=\mchoice{left,right,default} (initially default)}
Allows to choose where to place tick \emph{labels}. The choices |left| and |right| place tick labels either at the left or at the right side of the complete axis. The choice |default| uses the same setting as |xtick pos| (or |ytick pos|). This option is only useful for boxed axis -- keep it to |default| for non-boxed figures.
For $y$, the additional choices |bottom| and |top| can be used which are equivalent to |left| and |right|, respectively. Both are accepted for $y$.
For $x$, the additional choices |bottom| and |top| can be used which are equivalent to |left| and |right|, respectively. Both are accepted for $x$.
\end{pgfplotsxykey}
\begin{pgfplotskey}{ticklabelpos=\mchoice{left,right,default}}
Expand Down Expand Up @@ -4747,6 +4799,8 @@ \subsection{Miscellaneous Options}
\label{sec:disabledatascaling}%
\begin{pgfplotskey}{disabledatascaling=\mchoice{true,false} (initally false, default true)}
\index{Accuracy!Data Transformation}%
\index{Error Messages!dimension too large}%
Disables internal re-scaling of input data. Normally, every input data like plot coordinates, tick positions or whatever, are parsed without using \TeX's limited number precision. Then, a transformation like
\[ T(x) = 10^{q-m} \cdot x - a \]
is applied to every input coordinate/position where $m$ is ``the order of $x$'' base~$10$. Example: $x=1234 = 1.234\cdot 10^3$ has order~$m=4$ while $x=0.001234 = 1.234\cdot 10^{-3}$ has order $m=-2$. The parameter~$q$ is the order of the axis' width/height.
Expand All @@ -4760,7 +4814,7 @@ \subsection{Miscellaneous Options}
\end{pgfplotskey}
\begin{pgfplotsxykey}{\x\ filter/.code=\marg{...}} % FIXME create a xycodekey environment
\begin{pgfplotsxycodekeylist}{\x\ filter}
The code keys |x filter| and |y filter| allow coordinate filtering. A coordinate filter gets an input coordinate as |#1|, applies some operation and writes the result into the macro |\pgfmathresult|. If |\pgfmathresult| is empty afterwards, the coordinate is discarded.
It is allowed if filters do not |\pgfmathresult|. In this case, the unfiltered coordinate will be used.
Expand Down Expand Up @@ -4804,7 +4858,7 @@ \subsection{Miscellaneous Options}
If the corresponding axis is logarithmic, |#1| is the \emph{logarithm} of the coordinate as a real number, for example |#1=4.2341|.
The arguments to coordinate filters are not transformed. You may need to call coordinate parsing routines.
\end{pgfplotsxykey}
\end{pgfplotsxycodekeylist}
\begin{stylekey}{/pgfplots/skip coords between index=\marg{begin}\marg{end}}
A style which appends an |x filter| which discards selected coordinates. The selection is done by index where indexing starts with~$0$, see |\coordindex|. Every coordinate with index $\meta{begin} \le i < \meta{end}$ will be skipped.
Expand Down
35 changes: 21 additions & 14 deletions doc/latex/pgfplots/todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@
BUGS
-------------------------------------------------------------

- the check tick show and xticklabels does not work together.
+ empty plots cause bugs.

- newlines in plot coordinates cause an error.
-> provide sanity checking and correct error messages!
- one solution to newline problem: \edef the argument to plot coordinates before parsing it and
let \par to {}.
+ newlines in plot coordinates cause an error.
+ provide sanity checking and correct error messages!

- cycle list should be implemented using an array structure. That's faster.

- 'domain' can't be used to increase the data range, even when combined with fp.
+ 'domain' can't be used to increase the data range, even when combined with fp.
+ huge 'domain' arguments for 'plot function' lead to an 'dimension too large' error
although everything works fine

- the float math methods should be affected by the fixedpoint library, but they
are (because the underlying pgf math routines are exchanged).

- scaled ticks is not properly implemented for log axes
X scaled ticks is not properly implemented for log axes
+ it is not available for log axes, so that's ok

+ pgfplotstable and \rowcolor and 'sci sep align' in conjunction produces
overwritten digits! The color seems to be on top of the numbers left of the
Expand All @@ -35,16 +34,16 @@ BUGS

+ error bars should be drawn on top of the plot to avoid conflicts with filling.

- [xy]ticklabel pos values 'top' and 'bottom' are somewhat inconsistent with
+ [xy]ticklabel pos values 'top' and 'bottom' are somewhat inconsistent with
the actual placement

- the auto-disable-feature for logarithmic minor ticks can be overruled (or
- the auto-disable-feature for logarithmic minor ticks can be overruled (of
minor grid lines) which should not be possible
-> provide a good policy how to deal with user inputs:
1. draw minor tick/grids if requested
2. provide error message

- scatter is disabled if no default mark has been set.
+ scatter is disabled if no default mark has been set.

+ filter warnings are broken because they don't output the input coordinates

Expand All @@ -65,9 +64,10 @@ BUGS
-> FIX THAT! Ticks should be computed without this restriction (if necessary,
in float arithmetics)!

- it is not possible to provide '[xy]mode' in styles.
+ it is not possible to provide '[xy]mode' in styles.
-> ok, provided error message.

- check whether there are any plots before processing something like
+ check whether there are any plots before processing something like
'xtick=data' or so

+ the clipping of tick/grid lines is currently disabled due to the change to
Expand Down Expand Up @@ -338,6 +338,13 @@ FEATURES
- define a 'cycle list' style which simply inserts different colors into the
predefined style (thus, markers are fixed, colors vary). One could also think
about a complementary style.
-> even better: I could prodive up to three different lists which can be
combined.
Example: colorlist, markerlist, linespeclist
-> iterate through all possible combinations!

- cycle list should be implemented using an array structure. That's faster.


+ create public key alias for '/pgfplots/domain' -> '/tikz/domain'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
\pgfutil@ifundefined{pgfmathfloatint}{}{\endinput}
%\pgfkeysifdefined{/pgf/number format/min exponent for 1000 sep}{\endinput}{}


\pgfutil@ifundefined{pgfmathlessthan@}{%
\let\pgfmathlessthan@=\pgfmathless@
\let\pgfmathgreaterthan@=\pgfmathgreater@
}{}%

\immediate\write16{Package pgfplots: loading complementary code for your PGF version...}
\input pgfplotsoldpgfsupp_misc.code.tex
\input pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@
\tikzoption{jump mark right}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkright}
\tikzoption{jump mark left}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkleft}

\tikzoption{mark}{
\def\tikz@plot@mark{#1}%
\def\tikz@temp{none}% this check is relatively new
\ifx\tikz@temp\tikz@plot@mark
\let\tikz@plot@mark=\pgfutil@empty
\fi
}
% the 'every mark' style is new:
\tikzset{
every mark/.style={},
Expand Down
Loading

0 comments on commit 063bebf

Please sign in to comment.