diff options
author | Karl Berry <karl@freefriends.org> | 2010-10-29 00:31:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-10-29 00:31:31 +0000 |
commit | 6bc1f5497cfb2f56d65c80a4c36ea3bad6dc046c (patch) | |
tree | f7751da75030fb1e06653eeb44e579fcee09c65f /Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex | |
parent | ed0c7c756e441b2d2ba3633da233fc24361ac0d3 (diff) |
pgf 2.10 (28oct10)
git-svn-id: svn://tug.org/texlive/trunk@20236 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex | 85 |
1 files changed, 64 insertions, 21 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex index 5e7a703fd37..ea55ca8517b 100644 --- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/modules/pgfmoduleplot.code.tex,v 1.1 2008/01/15 10:27:34 tantau Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/modules/pgfmoduleplot.code.tex,v 1.8 2010/10/22 17:34:17 ludewich Exp $ % PGF's plotting interface works as follows: @@ -33,7 +33,7 @@ % \pgfplotstreamend % % By themselves, the \pgfplotstreamxxxx commands do not do anything by -% default. Rather, the ``use'' such a stream, you must first install a +% default. Rather, to ``use'' such a stream, you must first install a % stream handler. For example, the ``lineto'' handler will simply % translate every \pgfplotstreampoint into a \pgfpathlineto. % @@ -118,6 +118,29 @@ +% This handler turns creates a series of lineto commands, with the +% last command being a closepath, resulting in a closed path. +% +% Example: +% +% \pgfplothandlerpolygon +% \pgfplotxyfile{mytable} + +\def\pgfplothandlerpolygon{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@line@handler@close% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\pgfpathclose% + }% +} + +\def\pgf@plot@line@handler@close#1{% + \pgfpathmoveto{#1}% + \global\let\pgf@plotstreampoint=\pgfpathlineto% +} + + + % More handlers are defined in pgflibraryplothandlers @@ -187,8 +210,8 @@ \def\pgfplotxyfile#1{% \begingroup% \pgfplotstreamstart% - \openin1=#1 - \ifeof1 + \openin\r@pgf@reada=#1 + \ifeof\r@pgf@reada \PackageWarning{pgf}{Plot data file `#1' not found.} \else \catcode`\#=14 @@ -201,7 +224,7 @@ \let\pgf@savedpar=\par% \def\pgf@partext{\par} \def\pgf@readxyfile{% - \read1 to \pgf@temp% + \pgfutil@read\r@pgf@reada to \pgf@temp% \let\par=\pgf@savedpar% \edef\pgf@temp{\pgf@temp}% \ifx\pgf@temp\pgfutil@empty% @@ -209,7 +232,7 @@ \else% \expandafter\pgf@parsexyline\pgf@temp\pgf@stop% \fi\fi% - \ifeof1\else\expandafter\pgf@readxyfile\fi% + \ifeof\r@pgf@reada\else\expandafter\pgf@readxyfile\fi% } \def\pgf@parsexyline#1 #2 #3\pgf@stop{% @@ -236,8 +259,8 @@ \def\pgfplotxyzfile#1{% \begingroup% \pgfplotstreamstart% - \openin1=#1 - \ifeof1 + \openin\r@pgf@reada=#1 + \ifeof\r@pgf@reada \PackageWarning{pgf}{Plot data file `#1' not found.} \else \catcode`\#=14 @@ -248,13 +271,13 @@ } \def\pgf@readxyzfile{% - \read1 to \pgf@temp% + \pgfutil@read\r@pgf@reada to \pgf@temp% \ifx\pgf@temp\pgfutil@empty% \else\ifx\pgf@temp\pgf@partext% \else% \expandafter\pgf@parsexyzline\pgf@temp\pgf@stop% \fi\fi% - \ifeof1\else\expandafter\pgf@readxyzfile\fi% + \ifeof\r@pgf@reada\else\expandafter\pgf@readxyzfile\fi% } \def\pgf@parsexyzline#1 #2 #3 #4\pgf@stop{% @@ -285,38 +308,58 @@ { \catcode`\%=12 \catcode`\"=12 - \xdef\pgf@gnuplot@head#1{set terminal table; set output "#1.table"; set format "%.5f"} + \xdef\pgf@gnuplot@head{set table \noexpand\pgf@plottablefile@quoted; set format "%.5f"} } -\newwrite\pgf@plotwrite +\let\pgf@plotwrite=\w@pgf@writea \newif\ifpgf@resample@plot \def\pgfplotgnuplot{\pgfutil@ifnextchar[{\pgf@plotgnuplot}{\pgf@plotgnuplot[\jobname]}}%} \def\pgf@plotgnuplot[#1]#2{% \pgf@resample@plottrue% + \pgfutilpreparefilename{#1.gnuplot}% + \let\pgf@plotgnuplotfile=\pgfretval + \pgfutilpreparefilename{#1.table}% + \let\pgf@plottablefile=\pgfretval + \let\pgf@plottablefile@quoted=\pgfretvalquoted % Check, whether it is up-to-date - \openin\pgfutil@inputcheck=#1.gnuplot + \openin\pgfutil@inputcheck=\pgf@plotgnuplotfile\relax \ifeof\pgfutil@inputcheck% \else% - \read\pgfutil@inputcheck to\pgf@temp% ignored - \read\pgfutil@inputcheck to\pgf@plot@line% + \pgfutil@read\pgfutil@inputcheck to\pgf@temp% ignored + \pgfutil@read\pgfutil@inputcheck to\pgf@plot@line% + \closein\pgfutil@inputcheck \edef\pgf@plot@code{#2\space}% \ifx\pgf@plot@code\pgf@plot@line% - \openin\pgfutil@inputcheck=#1.table + \openin\pgfutil@inputcheck=\pgfretval\relax \ifeof\pgfutil@inputcheck% \else% + \closein\pgfutil@inputcheck \pgf@resample@plotfalse% \fi% \fi% \fi \ifpgf@resample@plot% - \immediate\openout\pgf@plotwrite=#1.gnuplot - \immediate\write\pgf@plotwrite{\pgf@gnuplot@head{#1}}% - \immediate\write\pgf@plotwrite{#2}% + \immediate\openout\pgf@plotwrite=\pgf@plotgnuplotfile\relax + \immediate\pgfutil@write\pgf@plotwrite{\pgf@gnuplot@head}% + \immediate\pgfutil@write\pgf@plotwrite{#2}% \immediate\closeout\pgf@plotwrite% - \immediate\write18{gnuplot #1.gnuplot} + \immediate\pgfutil@write18{gnuplot \pgf@plotgnuplotfile}% + \fi% + % temporarily redefine \pgf@parsexyline + \let\pgf@savedparsexyline=\pgf@parsexyline% + \let\pgf@parsexyline=\pgf@parsegnuplotxyline% + \pgfplotxyfile{\pgf@plottablefile}% + \let\pgf@parsexyline=\pgf@savedparsexyline% +} + +\def\pgf@parsegnuplotxyline#1 #2 #3\pgf@stop{% + \edef\pgf@xyline@flag@val{#3}% + \edef\pgf@xyline@flag@undef{u\space}% + \ifx\pgf@xyline@flag@val\pgf@xyline@flag@undef% + \else% + \pgfplotstreampoint{\pgfpointxy{#1}{#2}}% \fi% - \pgfplotxyfile{#1.table} } |