Re: Error bars in ln-space with PLOTERROR [message #55713] |
Tue, 04 September 2007 09:07 |
willettk
Messages: 20 Registered: October 2006
|
Junior Member |
|
|
On Sep 4, 4:01 am, Anthony <anthonysmit...@gmail.com> wrote:
> On Sep 4, 2:09 am, wille...@gmail.com wrote:
>
>
>
>> This is less an IDL question than a mathy one, but I've been banging
>> my head on it for a while without a solution - thank god for
>> newsgroups. I want to use PLOTERROR to give me a scatter plot in lin-
>> log space, with error bars in the y-direction. The quantities I want
>> to plot are x vs. ln(y), so I can't use the /ylog keyword (since that
>> gives me base10 logarithms, which I don't want). I can't figure out,
>> however, how to do proper error bars.
>
>> Here's an example:
>
>> ;;;;;
>> pro ll_plot
>
>> x = indgen(10)
>> y = indgen(10)
>> y_err = 1d-2 * indgen(10)
>
>> ploterror, x, ln(y), ln(y_err)
>
>> end
>> ;;;;;
>
>> In this case, PLOTERROR is plotting the y-values as ln(y) +/-
>> ln(y_err), while I want it to plot ln(y +/- y_err). Using the above
>> code gives error bars that are orders of magnitude larger than the
>> true error (the problem actually gets worse with smaller error bars).
>> Does anyone know of how to make PLOTERROR behave when plotting natural
>> logs with error bars (or some blindingly obvious thing that I'm doing
>> wrong)?
>
>> Many thanks.
>
> Hi,
>
> The error bars will be asymmetric, so you probably need to do
> something like this:
>
> x = indgen(10)+1
> y = indgen(10)+1
> y_err = 0.9 * (indgen(10)+1)
> plot, x, alog(y), yrange=[-3,3]
> oploterror, x, alog(y), alog(y)-alog(y-y_err), /lobar
> oploterror, x, alog(y), alog(y+y_err)-alog(y), /hibar
>
> Anthony
That worked well - thanks for the help.
|
|
|
Re: Error bars in ln-space with PLOTERROR [message #55729 is a reply to message #55713] |
Tue, 04 September 2007 03:01  |
Anthony[1]
Messages: 20 Registered: December 2006
|
Junior Member |
|
|
On Sep 4, 2:09 am, wille...@gmail.com wrote:
> This is less an IDL question than a mathy one, but I've been banging
> my head on it for a while without a solution - thank god for
> newsgroups. I want to use PLOTERROR to give me a scatter plot in lin-
> log space, with error bars in the y-direction. The quantities I want
> to plot are x vs. ln(y), so I can't use the /ylog keyword (since that
> gives me base10 logarithms, which I don't want). I can't figure out,
> however, how to do proper error bars.
>
> Here's an example:
>
> ;;;;;
> pro ll_plot
>
> x = indgen(10)
> y = indgen(10)
> y_err = 1d-2 * indgen(10)
>
> ploterror, x, ln(y), ln(y_err)
>
> end
> ;;;;;
>
> In this case, PLOTERROR is plotting the y-values as ln(y) +/-
> ln(y_err), while I want it to plot ln(y +/- y_err). Using the above
> code gives error bars that are orders of magnitude larger than the
> true error (the problem actually gets worse with smaller error bars).
> Does anyone know of how to make PLOTERROR behave when plotting natural
> logs with error bars (or some blindingly obvious thing that I'm doing
> wrong)?
>
> Many thanks.
Hi,
The error bars will be asymmetric, so you probably need to do
something like this:
x = indgen(10)+1
y = indgen(10)+1
y_err = 0.9 * (indgen(10)+1)
plot, x, alog(y), yrange=[-3,3]
oploterror, x, alog(y), alog(y)-alog(y-y_err), /lobar
oploterror, x, alog(y), alog(y+y_err)-alog(y), /hibar
Anthony
|
|
|
Re: Error bars in ln-space with PLOTERROR [message #55730 is a reply to message #55729] |
Tue, 04 September 2007 03:01  |
Anthony[1]
Messages: 20 Registered: December 2006
|
Junior Member |
|
|
On Sep 4, 2:09 am, wille...@gmail.com wrote:
> This is less an IDL question than a mathy one, but I've been banging
> my head on it for a while without a solution - thank god for
> newsgroups. I want to use PLOTERROR to give me a scatter plot in lin-
> log space, with error bars in the y-direction. The quantities I want
> to plot are x vs. ln(y), so I can't use the /ylog keyword (since that
> gives me base10 logarithms, which I don't want). I can't figure out,
> however, how to do proper error bars.
>
> Here's an example:
>
> ;;;;;
> pro ll_plot
>
> x = indgen(10)
> y = indgen(10)
> y_err = 1d-2 * indgen(10)
>
> ploterror, x, ln(y), ln(y_err)
>
> end
> ;;;;;
>
> In this case, PLOTERROR is plotting the y-values as ln(y) +/-
> ln(y_err), while I want it to plot ln(y +/- y_err). Using the above
> code gives error bars that are orders of magnitude larger than the
> true error (the problem actually gets worse with smaller error bars).
> Does anyone know of how to make PLOTERROR behave when plotting natural
> logs with error bars (or some blindingly obvious thing that I'm doing
> wrong)?
>
> Many thanks.
Hi,
The error bars will be asymmetric, so you probably need to do
something like this:
x = indgen(10)+1
y = indgen(10)+1
y_err = 0.9 * (indgen(10)+1)
plot, x, alog(y), yrange=[-3,3]
oploterror, x, alog(y), alog(y)-alog(y-y_err), /lobar
oploterror, x, alog(y), alog(y+y_err)-alog(y), /hibar
Anthony
|
|
|