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


Am 23.12.2011 23:19, schrieb Joseph Wright:
> On 23/12/2011 20:52, Joseph Wright wrote:
>> Hello Christian,
>>
>> A quick pgfplots question. I have some data where I have ranges for the
>> y value, so something like
>>
>> 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
>>
>> This is easy enough to put in using an external table, but I can't find
>> a reference in the manual to either (1) giving errors as absolute
>> max/min values rather than as shits and (2) different errors on the plus
>> and minus side of a value. Am I correct in thinking that at present this
>> can't be done using pgfplots?
>>
>> Regards,
>>
>> Joseph
> Hello Christian
>
> Ah, I've worked it out: do two columns of y values, the real set and a
> centred set, and use the later for the error bars.
>
> Joseph


------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Pgfplots-features mailing list
Pgfplots-features@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pgfplots-features

Reply via email to