comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Error bars in ln-space with PLOTERROR
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Error bars in ln-space with PLOTERROR [message #55713] Tue, 04 September 2007 09:07 Go to previous message
willettk is currently offline  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.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: stack vector plots
Next Topic: Bug in IDL's FILE_INFO function

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:26:02 PDT 2025

Total time taken to generate the page: 0.00548 seconds