On 28/12/2011 15:00, Christian Feuersaenger wrote:
> Hi Joseph,
>
> thanks for the interesting question!
>
> (1) "Can I give errors as absolute min/max values instead of differences"?
>
> -> Yes, especially if you have table input: you can use 'y error
> expr=<expression>' where <expression> is some math expression which may
> depend on \thisrow{<colname>} (the syntax is actually the same as for y
> expr=<expression>).
>
> (2) "Can I have asymmetric error bars?"
>
> -> Pgfplots currently expects symmetric error values (there are pending
> feature requests to add asymmetric error bars).
> At the time of this writing, a good work-around is to use the same plot
> twice: once for upper and once for lower error values. In addition, one
> of them should have "forget plot" to avoid a legend entry.
>
> A complete working example with your data could be
>
> \documentclass{article}
>
> \usepackage{pgfplots}
>
> \begin{document}
>
> \begin{tikzpicture}
> \begin{axis}
> \addplot+[forget plot,error bars/.cd,y dir=plus,y explicit]
> table[x=x,y=y,y error expr=\thisrow{y_max}-\thisrow{y}] {
> x y y_min y_max
> 1 0.01 -0.01 0.02
> 2 0.03 0.00 0.035
> 3 -0.05 -0.06 -0.04
> 4 0.06 0.05 0.07
> };
> \addplot+[error bars/.cd,y dir=minus,y explicit]
> table[x=x,y=y,y error expr=\thisrow{y}-\thisrow{y_min}] {
> x y y_min y_max
> 1 0.01 -0.01 0.02
> 2 0.03 0.00 0.035
> 3 -0.05 -0.06 -0.04
> 4 0.06 0.05 0.07
> };
> \end{axis}
> \end{tikzpicture}
> \end{document}
>
> Clearly, you will only provide the data once (either from file or using
> \pgfplotstableread) -- but you get the idea.
>
> Your approach appears to have a similar effect: the idea with two data
> sets is the same as my answer for (2). The centered set will work as
> well from what I understand.
>
> I hope you enjoyed christmas! My best wishes for the new year!
>
> Best regards
>
> Christian
Hello Christian,
Ah, excellent: thanks very much. I've been asked this by someone else,
and avoiding editing the data if possible is handy.
A second question, if I may. In my demo data, you'll see that the
y-values are all < 0.1. pgfplots automatically formats these as integers
with a \cdot 10^{-2} applied to the axis. However, in this particular
case I'd like to stick to printing the values as given. Usually, I edit
the input data to deal with powers of ten, but that does not apply here.
Various applications of /pgf/number format keys fail to achieve the
desired outcome. Is there an easy way to print the tick labels?
--
Joseph Wright
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Pgfplots-features mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pgfplots-features