[pstricks] PSTricks Digest, Vol 78, Issue 18

Anne Scholze AS.81 at gmx.de
Wed Jul 29 19:45:27 CEST 2009


Hallo Marco,

thank you for your immediate help!! Now, I've almost got the solution! Just one question: If I plot the error bars, pstricks overwrite the dots of the line diagrams. How I can I avoid this? Unfortunately, I don't know where I can change this. Here is my actual code:

\documentclass{book}
\pagestyle{empty}
\usepackage{filecontents}
\begin{filecontents}{chlora.dat}
2.5 0.0006 -0.00006 0.00006
5 0.0023 -0.00030 0.00030
8 0.0043 -0.00087 0.00087
12 0.0070 -0.00038 0.00038
24 0.0260 -0.00282 0.00282
96 0.1070 -0.01009 0.01009
\end{filecontents}

\begin{filecontents}{chlorb.dat}
2.5 0.000125 -0.000019 0.000019
5 0.000871 -0.000115 0.000115
8 0.001662 -0.000363 0.000363
12 0.002551 -0.000074 0.000074
24 0.010362 -0.000791 0.000791
96 0.041813 -0.003139 0.003139
\end{filecontents}

\begin{filecontents}{car.dat}
2.5 0.004844 -0.001257 0.001257
5 0.007768 -0.000473 0.000473
8 0.008724 -0.001851 0.001851
12 0.010832 -0.000547 0.000547
24 0.023058 -0.001593 0.001593
96 0.071241 0.004431 0.004431
\end{filecontents}


\usepackage[dvips]{pstricks}%pst-col nicht mehr verwenden, pstricks lädt automatisch xcolor
\usepackage{bardiag,pst-node,pstricks-add,pst-plot}%pst-plot ist bereits in pstricks-add enthalten
\usepackage[thinqspace,squaren,Gray,thinspace,binary,textstyle]{SIunits}

\SpecialCoor\makeatletter
\def\errorLine{\@ifnextchar[{\pst at errorLine}{\pst at errorLine[]}}
\def\pst at errorLine[#1](#2)#3#4{{%
  \def\pst at tempa{#1}\ifx\pst at tempa\@empty\else\psset{#1}\fi
  \pst at getcoor{#2}\pst at tempb
  \psline{|-|}(!\pst at tempb\space pop \pst at number\psxunit div
    \pst at tempb\space exch pop \pst at number\psyunit div #3\space add)
  (!\pst at tempb\space pop \pst at number\psxunit div
    \pst at tempb\space exch pop \pst at number\psyunit div #4\space add )}}
\def\GetCoordinates#1{\expandafter\GetCoordinates at i#1}
\def\GetCoordinates at i #1{\GetCoordinates at ii#1}
\def\GetCoordinates at ii#1 #2 #3 #4 #5 #6 #7 #8 {%
  \DoCoordinate{#2}{#4}\errorLine[linecolor=black,linewidth=.5pt](#2,#4){#6}{#8}% <<<<<
  \@ifnextchar D{\GetCoordinates at ii}{}}
\makeatother

\definecolor{greenblue}{rgb}{0 1 0.50002}
\definecolor{yellowgreen}{rgb}{0.75002, 1, 0}
\definecolor{orange}{rgb}{1, 0.49998, 0}

\begin{document}
\readdata{\Data}{chlora.dat}\psset{dotscale=1.5}
\readdata{\myData}{chlorb.dat}\psset{dotscale=1.5}
\readdata{\moreData}{car.dat}\psset{dotscale=1.5}
\psset{xunit=0.1cm,yunit=30cm,runit=1cm}
\begin{pspicture}(-.1,-.04)(100,0.15)
\psaxes[Dx=5,Dy=0.02,axesstyle=frame]{->}(100,0.15)
\uput{0.9}[-90](50,-0.001){time (\hour)}
\uput{0.9}[180]{90}(-1,0.07){\nano\gram\usk\milli\reciprocal\gram FM}
\listplot[plotstyle=line,showpoints=true,dotstyle=triangle,linecolor=greenblue,plotNo=1,plotNoMax=3]{\Data}
\listplot[plotstyle=line,showpoints=true,dotstyle=square,linecolor=yellowgreen,plotNo=1,plotNoMax=3]{\myData}
\listplot[plotstyle=line,showpoints=true,dotstyle=pentagon,linecolor=orange,plotNo=1,plotNoMax=3]{\moreData}
\def\DoCoordinate#1#2{\psdot(#1,#2)}\GetCoordinates{\Data}
\def\DoCoordinate#1#2{\psdot(#1,#2)}\GetCoordinates{\myData}
\def\DoCoordinate#1#2{\psdot(#1,#2)}\GetCoordinates{\moreData}
\end{pspicture}


\end{document}

Thank you for patience, best regards, Anne.




-------- Original-Nachricht --------
> Datum: Mon, 27 Jul 2009 12:00:03 +0200
> Von: pstricks-request at tug.org
> An: pstricks at tug.org
> Betreff: PSTricks Digest, Vol 78, Issue 18

> Send PSTricks mailing list submissions to
> 	pstricks at tug.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://tug.org/mailman/listinfo/pstricks
> or, via email, send a message with subject or body 'help' to
> 	pstricks-request at tug.org
> 
> You can reach the person managing the list at
> 	pstricks-owner at tug.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of PSTricks digest..."
> 
> 
> Today's Topics:
> 
>    1. line diagramm with error bars (Anne Scholze)
>    2. Re: line diagramm with error bars (Marco Daniel)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Sun, 26 Jul 2009 21:21:35 +0200
> From: "Anne Scholze" <AS.81 at gmx.de>
> To: pstricks at tug.org
> Subject: [pstricks] line diagramm with error bars
> Message-ID: <20090726192135.85290 at gmx.net>
> Content-Type: text/plain; charset="us-ascii"
> 
> Dear Herbert et. al,
> 
> in the beginning of June I asked how to draw a line diagram with error
> bars with pstricks and Herbert answered me immediately. Thanks a lot!!!
> But I was not really successful in plotting my data. I have two different
> series which I would like to show in the diagram each connected by a line
> and every data point with the accordant error bars. I'm able to get the data
> points with the error bars, but I don't know if it is possible to use the
> same series with one command to draw the line between the points. 
> I've checked the command \listplot[plotstyle=line,showpoints=true]{\Data}
> but it doesn't work in a right way probably because there are 4 instead of
> 2 arguments. 
> Please, can you help me?
> Here is my code:
> 
> \documentclass{book}
> \pagestyle{empty}
> 
> \begin{filecontents}{chlora.dat}
> 2.5 0.0006 -0.00006 0.00006
> 5 0.0023 -0.00030 0.00030
> 8 0.0043 -0.00087 0.00087
> 12 0.0070 -0.00038 0.00038
> 24 0.0260 -0.00282 0.00282
> 96 0.1070 -0.01009 0.01009
> \end{filecontents}
> 
> \begin{filecontents}{chlorb.dat}
> 2.5 0.000125 -0.000019 0000019
> 5 0.000871 -0.000115 0.000115
> 8 0.001662 -0.000363 0.000363
> 12 0.002551 -0.000074 0.000074
> 24 0.010362 -0.000791 0.000791
> 96 0.041813 -0.003139 0.003139
> \end{filecontents}
> 
> %\StartShownPreambleCommands
> \usepackage{pstricks,pst-plot}
> \SpecialCoor\makeatletter
> \def\errorLine{\@ifnextchar[{\pst at errorLine}{\pst at errorLine[]}}
> \def\pst at errorLine[#1](#2)#3#4{{%
>   \def\pst at tempa{#1}\ifx\pst at tempa\@empty\else\psset{#1}\fi
>   \pst at getcoor{#2}\pst at tempb
>   \psline{|-|}(!\pst at tempb\space pop \pst at number\psxunit div
>     \pst at tempb\space exch pop \pst at number\psyunit div #3\space add)
>   (!\pst at tempb\space pop \pst at number\psxunit div
>     \pst at tempb\space exch pop \pst at number\psyunit div #4\space add )}}
> \def\GetCoordinates#1{\expandafter\GetCoordinates at i#1}
> \def\GetCoordinates at i #1{\GetCoordinates at ii#1}
> \def\GetCoordinates at ii#1 #2 #3 #4 #5 #6 #7 #8 {%
>  
> \DoCoordinate{#2}{#4}\errorLine[linecolor=red,linewidth=.5pt](#2,#4){#6}{#8}% <<<<<
>   \@ifnextchar D{\GetCoordinates at ii}{}}
> \makeatother
> %\StopShownPreambleCommands
> 
> \psset{xunit=0.15cm,yunit=40cm,runit=1cm}
> 
> \begin{document}
> \readdata{\Data}{chlora.dat}\psset{dotscale=.8}
> %\readdata{\Data}{chlorb.dat}\psset{dotscale=.8}
> \begin{pspicture}(-.1,-.1)(100,0.15)
>   \psaxes[Dx=5,Dy=0.02]{->}(100,0.15)
> \listplot[plotstyle=line,showpoints=true]{\Data}
> \def\DoCoordinate#1#2{\psdot(#1,#2)}\GetCoordinates{\Data}
> %\listplot[plotstyle=line,showpoints=true]{\Data}
> %\def\DoCoordinate#1#2{\psdot(#1,#2)}\GetCoordinates{\Data}
>    
> \end{pspicture}
> \end{document}
> 
> Best regards, Anne.
> 
> 
> 
> -- 
> Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 -
> sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Mon, 27 Jul 2009 07:19:25 +0200
> From: Marco Daniel <marcodaniel1807 at googlemail.com>
> To: pstricks at tug.org
> Subject: Re: [pstricks] line diagramm with error bars
> Message-ID:
> 	<84a7370c0907262219k6b31c5cq44739bdfd8ad1476 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hello,
> 
> I don't know what you want to reach. Maybe you can use the package
> pstricks-add which provide the command plotNoMax.
> 
> Here an example:
> 
> %%%%
> \documentclass{book}
> \pagestyle{empty}
> \usepackage{filecontents}
> \begin{filecontents}{chlora.dat}
> 2.5 0.0006 -0.00006 0.00006
> 5 0.0023 -0.00030 0.00030
> 8 0.0043 -0.00087 0.00087
> 12 0.0070 -0.00038 0.00038
> 24 0.0260 -0.00282 0.00282
> 96 0.1070 -0.01009 0.01009
> \end{filecontents}
> 
> \begin{filecontents}{chlorb.dat}
> 2.5 0.000125 -0.000019 0.000019
> 5 0.000871 -0.000115 0.000115
> 8 0.001662 -0.000363 0.000363
> 12 0.002551 -0.000074 0.000074
> 24 0.010362 -0.000791 0.000791
> 96 0.041813 -0.003139 0.003139
> \end{filecontents}
> 
> \usepackage{pstricks,pst-plot}
> \usepackage{pstricks-add}
> \psset{xunit=0.15cm,yunit=80cm,runit=1cm}
> \begin{document}
> % \readdata{\Data}{chlora.dat}\psset{dotscale=.8}
> \readdata{\Data}{chlorb.dat}\psset{dotscale=.8}
> \begin{pspicture}(-.1,-.1)(100,0.07)
>   \psaxes[Dx=5,Dy=0.02]{->}(100,0.06)
> \listplot[plotstyle=line,showpoints=true,plotNo=1,plotNoMax=3]{\Data}
> \listplot[plotstyle=bar,linecolor=green,showpoints=true,plotNo=1,plotNoMax=3]{\Data}
> \listplot[linecolor=red,plotstyle=line,showpoints=true,plotNo=2,plotNoMax=3]{\Data}
> \listplot[linecolor=blue,plotstyle=line,showpoints=true,plotNo=3,plotNoMax=3]{\Data}
> \end{pspicture}
> \end{document}
> %%%%%%%%%%
> 
> regards
> Marco
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <http://tug.org/pipermail/pstricks/attachments/20090727/621615aa/attachment-0001.html>
> 
> ------------------------------
> 
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
> 
> 
> End of PSTricks Digest, Vol 78, Issue 18
> ****************************************

-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser


More information about the PSTricks mailing list