Main Page | Report Page

 

  Computers Forum Index » Computer Languages (IDL-PVWAVE) » IDL 8, log plots and titles...

Author Message
b_gom...
Posted: Tue Oct 26, 2010 7:03 pm
 
Am I missing something, or is IDL 8 fumbling logarithmic y axes and
plot titles when using the new plot function?

When plotting log plots, the plot title seems to vanish, and also IDL
does not seem to be able to calculate the y range properly. In the
sample code below, compare the direct graphics output (which handles
the range and title correctly automatically) to the new plot function
output which doesn't seem to be able to figure out what I want:

----------------------------------------
x=findgen(100)/100*3*!pi
y=sin(x)

;This is what I expect; yaxis handles infinite log range and title
appears correctly
plot,x,y,/ylog,title='Direct Graphics Yrange and Title'

;Now for the plot function output:
;title works for linear y axes
p1=plot(x,y,yrange=[0.1,1],title='Linear Y Axis
Works',window_title='Linear Y Axis Works')
;title gone for log plots
p2=plot(x,y,/ylog,yrange=[0.1,1],title='Title Error Log Y
Axis',window_title='Title Error Log Y Axis')
;if you set the yrange, the title appears, but in the wrong place
p3=plot(x,(y+2)*10,/ylog,yrange=[1,100],title='Title Error Log Y
Axis',window_title='Title Error Log Y Axis')
;if you don't set the yrange, the title is gone
p4=plot(x,(y+2)*10,/ylog,title='Title Error Log Y
Axis',window_title='Title Error Log Y Axis')
----------------------------------------

Any ideas?
 
Paolo...
Posted: Tue Oct 26, 2010 8:33 pm
 
On Oct 26, 3:03 pm, b_gom <b_... at (no spam) hotmail.com> wrote:
Quote:
Am I missing something, or is IDL 8 fumbling logarithmic y axes and
plot titles when using the new plot function?

When plotting log plots, the plot title seems to vanish, and also IDL
does not seem to be able to calculate the y range properly. In the
sample code below, compare the direct graphics output (which handles
the range and title correctly automatically) to the new plot function
output which doesn't seem to be able to figure out what I want:

----------------------------------------
x=findgen(100)/100*3*!pi
y=sin(x)

;This is what I expect; yaxis handles infinite log range and title
appears correctly
plot,x,y,/ylog,title='Direct Graphics Yrange and Title'

"correctly"? I think the automatic choice of yrange for a logarithmic
plot is a matter of personal preference - but certainly for any
serious
work you want to set the yrange explicitely yourself. But even when I
am
too lazy to do so, I would prefer this behavior as default:

title='pretty plot'

;pardon the kilometric one-liner
;wrapped to survive google groups posting
plot,x,y,/ylog, $
yrange=total(y GT 0) GT 0 ? $
[min(y[where(y GT 0)]),max(y)] : $
[(machar()).xmin,(machar()).xmax],$
title=total(y LT 0) GT 0 ? $
'NEGATIVE VALUES NOT PLOTTED '+$
title:title



Ciao,
Paolo


Quote:

;Now for the plot function output:
;title works for linear y axes
p1=plot(x,y,yrange=[0.1,1],title='Linear Y Axis
Works',window_title='Linear Y Axis Works')
;title gone for log plots
p2=plot(x,y,/ylog,yrange=[0.1,1],title='Title Error Log Y
Axis',window_title='Title Error Log Y Axis')
;if you set the yrange, the title appears, but in the wrong place
p3=plot(x,(y+2)*10,/ylog,yrange=[1,100],title='Title Error Log Y
Axis',window_title='Title Error Log Y Axis')
;if you don't set the yrange, the title is gone
p4=plot(x,(y+2)*10,/ylog,title='Title Error Log Y
Axis',window_title='Title Error Log Y Axis')
----------------------------------------

Any ideas?

 
b_gom...
Posted: Tue Oct 26, 2010 9:21 pm
 
Well, maybe 'correctly' was the wrong choice of words. I meant that
the direct graphics routines almost always do something reasonable if
you don't set any keywords. They don't refuse to plot logarithmic data
or hide titles, for example. I won't be carrying around
"yrange=total(y GT 0) GT 0 ? > [min(y[where(y GT 0)]),max(y)] :
[(machar()).xmin,(machar()).xmax]" in my head each time I want to do a
quick log plot..

I've been encouraging coleagues to start using IDL 8 because of the
great new graphics functions, and almost immediately I get questions
about plot behaviour that I can't explain.

A related question- I assume it isn't possible to produce multiple
plots with the new graphics functions without manually defining the
layout. i.e., there is no equivalent of setting !p.multi. Is this
true?

Thanks


On Oct 26, 2:33 pm, Paolo <pgri... at (no spam) gmail.com> wrote:

Quote:
"correctly"? I think the automatic choice of yrange for a logarithmic
plot is a matter of personal preference - but certainly for any
serious
work you want to set the yrange explicitely yourself. But even when I
am
too lazy to do so, I would prefer this behavior as default:

title='pretty plot'

;pardon the kilometric one-liner
;wrapped to survive google groups posting
plot,x,y,/ylog, $
yrange=total(y GT 0) GT 0 ? $
[min(y[where(y GT 0)]),max(y)] : $
[(machar()).xmin,(machar()).xmax],$
title=total(y LT 0) GT 0 ? $
'NEGATIVE VALUES NOT PLOTTED '+$
title:title

Ciao,
Paolo





;Now for the plot function output:
;title works for linear y axes
p1=plot(x,y,yrange=[0.1,1],title='Linear Y Axis
Works',window_title='Linear Y Axis Works')
;title gone for log plots
p2=plot(x,y,/ylog,yrange=[0.1,1],title='Title Error Log Y
Axis',window_title='Title Error Log Y Axis')
;if you set the yrange, the title appears, but in the wrong place
p3=plot(x,(y+2)*10,/ylog,yrange=[1,100],title='Title Error Log Y
Axis',window_title='Title Error Log Y Axis')
;if you don't set the yrange, the title is gone
p4=plot(x,(y+2)*10,/ylog,title='Title Error Log Y
Axis',window_title='Title Error Log Y Axis')
----------------------------------------

Any ideas?- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -

 
Paul van Delst...
Posted: Wed Oct 27, 2010 12:16 am
 
b_gom wrote:
Quote:
Am I missing something, or is IDL 8 fumbling logarithmic y axes and
plot titles when using the new plot function?

When plotting log plots, the plot title seems to vanish, and also IDL
does not seem to be able to calculate the y range properly. In the
sample code below, compare the direct graphics output (which handles
the range and title correctly automatically) to the new plot function
output which doesn't seem to be able to figure out what I want:

[test code elided]

My only comment: crikey!

I just ran the same plots as those of the OP but using OG (iplot) rather than NG and I get the same behaviour. Anyone
out there with a v7 install that can run the code using iplot? E.g.

x=findgen(100)/100*3*!pi
y=sin(x)
iplot,x,y,yrange=[0.1,1],title='Linear Y Axis Works',window_title='Linear Y Axis Works'
iplot,x,y,/ylog,yrange=[0.1,1],title='Title Error Log Y Axis',window_title='Title Error Log Y Axis'
iplot,x,(y+2)*10,/ylog,yrange=[1,100],title='Title Error Log Y Axis',window_title='Title Error Log Y Axis'
iplot,x,(y+2)*10,/ylog,title='Title Error Log Y Axis',window_title='Title Error Log Y Axis'

Does one see the same behaviour with v7 OG? Because, if they do that would mean OG has been buggy for a while. On the
plus side, if v7 OG *does not* exhibit the same behaviour, it should be easy for ITTVIS to fix this in v8 since it's a
recent introduction. (Right? Surprised)

To be fair to the ITTVIS folks, it's got to be difficult to test graphics systems. I mean, how do you test (unit or
regression) the sort of problems the OP is encountering?

But, still.....

cheers,

paulv
 
David Fanning...
Posted: Wed Oct 27, 2010 12:39 am
 
b_gom writes:

Quote:
Am I missing something, or is IDL 8 fumbling logarithmic y axes and
plot titles when using the new plot function?

I'm sure the title around there somewhere. Have you
scrolled around in the plot a bit? That's why the
plot scrolling is turned on by default. So you can
find things when they go missing.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
 
Jeremy Bailin...
Posted: Wed Oct 27, 2010 3:30 am
 
On Oct 26, 4:16 pm, Paul van Delst <paul.vande... at (no spam) noaa.gov> wrote:
Quote:
b_gom wrote:
Am I missing something, or is IDL 8 fumbling logarithmic y axes and
plot titles when using the new plot function?

When plotting log plots, the plot title seems to vanish, and also IDL
does not seem to be able to calculate the y range properly. In the
sample code below, compare the direct graphics output (which handles
the range and title correctly automatically) to the new plot function
output which doesn't seem to be able to figure out what I want:

[test code elided]

My only comment: crikey!

I just ran the same plots as those of the OP but using OG (iplot) rather than NG and I get the same behaviour. Anyone
out there with a v7 install that can run the code using iplot? E.g.

x=findgen(100)/100*3*!pi
y=sin(x)
iplot,x,y,yrange=[0.1,1],title='Linear Y Axis Works',window_title='Linear Y Axis Works'
iplot,x,y,/ylog,yrange=[0.1,1],title='Title Error Log Y Axis',window_title='Title Error Log Y Axis'
iplot,x,(y+2)*10,/ylog,yrange=[1,100],title='Title Error Log Y Axis',window_title='Title Error Log Y Axis'
iplot,x,(y+2)*10,/ylog,title='Title Error Log Y Axis',window_title='Title Error Log Y Axis'

Does one see the same behaviour with v7 OG? Because, if they do that would mean OG has been buggy for a while. On the
plus side, if v7 OG *does not* exhibit the same behaviour, it should be easy for ITTVIS to fix this in v8 since it's a
recent introduction. (Right? Surprised)

To be fair to the ITTVIS folks, it's got to be difficult to test graphics systems. I mean, how do you test (unit or
regression) the sort of problems the OP is encountering?

But, still.....

cheers,

paulv

I don't see a title on any of those.

IDL> print, !version
{ x86_64 darwin unix Mac OS X 7.0.4 Sep 3 2008 64 64}

-Jeremy.
 
Paulo Penteado...
Posted: Wed Oct 27, 2010 4:26 am
 
On Oct 26, 7:21 pm, b_gom <b_... at (no spam) hotmail.com> wrote:
Quote:
A related question- I assume it isn't possible to produce multiple
plots with the new graphics functions without manually defining the
layout. i.e., there is no equivalent of setting !p.multi. Is this
true?

No. See the posts at the end of

http://groups.google.com/group/comp.lang.idl-pvwave/browse_thread/thread/4d0d4deb79085aa6
 
 
Page 1 of 1    
All times are GMT
The time now is Mon Apr 21, 2014 5:33 am