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

Home » Public Forums » archive » Function graphics axis range - how to get it consistently?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Function graphics axis range - how to get it consistently? [message #87864] Fri, 28 February 2014 08:37 Go to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Hello,

I'm plotting a simple time series (of program execution times) and, at
certain times, I want to indicate an occurrance (e.g. rebuild,
optimisation, etc).

I want to indicate this occurrance with a vertical dashed line that
spans the entire yrange of the completed plot.

Here is how I plot the actual data:

FOR i = 0L, n_times-1L DO BEGIN
tp[i] = PLOT( date_time, timing[*,i], $
TITLE='Host : ' + host + '!C' + $
'CRTM root : ' + crtm_root + '!C' + $
'Sensor Id : ' + sensor_id + '!C' + $
'CRTM version : ' + crtm_version + '!C' + $
'Current Date : ' + SYSTIME(), $
XTITLE='Date', $
YTITLE='Run time (sec.)', $
XTICKFORMAT='LABEL_DATE', $
MARGIN=[0.1,0.1,0.25,0.15], $
DIMENSIONS=[xsize,ysize], $
COLOR=color[i], $
THICK=2, $
FONT_SIZE=9, $
SYMBOL='diamond', $
OVERPLOT=i, $
NAME=legend_strings[i], $
BUFFER=buffer )
ENDFOR
l = LEGEND( TARGET=tp, $
ORIENTATION=0, $
FONT_SIZE=7, $
HORIZONTAL_ALIGNMENT='CENTER', $
VERTICAL_ALIGNMENT='CENTER', $
POSITION=[0.91,0.5] )


No worries. Works great. I then do the following to plot the vertical
line and an associated text string if there is a comment associated with
any of the dates/times:

idx = WHERE(STRLEN(comment) GT 0, n_comments)
print, tp[0].YRANGE
IF ( n_comments GT 0 ) THEN BEGIN
FOR i = 0, n_comments-1 DO BEGIN
c = PLOT( [date_time[idx[i]],date_time[idx[i]]], tp[0].YRANGE, $
XTICKFORMAT='LABEL_DATE', $
LINESTYLE='dashed', $
/OVERPLOT, $
BUFFER=buffer )
t = TEXT( date_time[idx[i]], (tp[0].YRANGE)[1], $
comment[idx[i]], $
FONT_SIZE=7, $
/DATA, $
TARGET=tp[0], $
ALIGNMENT=0.5, $
VERTICAL_ALIGNMENT=1.0 )
ENDFOR
ENDIF

Note that in the PLOT() command I'm using tp[0].YRANGE to specify the,
well, yrange of the vertical line, and in the TEXT() command I'm using
(tp[0].YRANGE)[1] to position the text at the top of the line.

When I run the above code I get the following output from the
"print, tp[0].YRANGE" command:
0.0000000 350.00000

(also note that tp[0].AXIS_RANGE is [0,0])

BUT, my plot looks like this:
ftp://ftp.emc.ncep.noaa.gov/jcsda/CRTM/timing/emc-lw-pvandel .trunk.amsua_metop-a.v2_2_0-alpha.timing.png

As you can see (I hope) the ACTUAL y-axis range is [0,400], not [0,350].
Additionally, while the vertical line plot only goes up to 350 the
TEXT() output, which should also be positioned at 350 since it uses the
same yrange data, is actually positioned at 400 - the "true" maximum
yrange value.

WTF?

So I have two questions:
1) How does one get the ACTUAL yrange values used in a plot?
2) Why does the TEXT() function position the text differently than the
PLOT() function plots when the same YRANGE property is being used?

Am I doing something wrong here or, as I'm beginning to suspect, is the
random number generator at the heart of Function Graphics funnin' with me?

cheers,

paulv
Re: Function graphics axis range - how to get it consistently? [message #87865 is a reply to message #87864] Fri, 28 February 2014 08:50 Go to previous messageGo to next message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
I think you want to set YStyle = 1... Let me know if that works.
Re: Function graphics axis range - how to get it consistently? [message #87866 is a reply to message #87865] Fri, 28 February 2014 09:15 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matthew Argall writes:

> I think you want to set YStyle = 1... Let me know if that works.

Yeah, my first thought is there is a yrange and ycrange and that
function graphics is not handling those two things consistently.

But, I like the random number theory, too. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Function graphics axis range - how to get it consistently? [message #87867 is a reply to message #87865] Fri, 28 February 2014 10:06 Go to previous messageGo to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Hi Matthew,

On 02/28/14 11:50, Matthew Argall wrote:
> I think you want to set YStyle = 1... Let me know if that works.

I tried that and it "works" in that it does what I understand Ystyle=1
should do: force the axis range to be exactly that of the data.

But I don't want that.

I just want the axis properties (sans usage of Ystyle) to agree with
their manifestation. Otherwise, what's the point?

To paraphrase Inigo Montoya, regarding the property YRANGE:
"You keep using that word. I do not think it means what you think it means."

Sigh. Looks like my colleagues win (again, dammit). Anaconda[*] is my
next step.

cheers,

paulv

[*] https://store.continuum.io/cshop/anaconda/
Re: Function graphics axis range - how to get it consistently? [message #87868 is a reply to message #87867] Fri, 28 February 2014 10:18 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paul van Delst writes:

> To paraphrase Inigo Montoya, regarding the property YRANGE:
> "You keep using that word. I do not think it means what you think it means."

It has been one of those days. (Well, honestly, it has been one of those
weeks.) I finally got a chance to take a shower a few minutes ago and I
was thinking as the hot water splashed over me, that as long as I was
asking philosophical questions that remain unanswered, here is another.
When you say:

"For the record, I use FG pretty much exclusively.
I think they're great."

Do you mean great from an "idea" perspective? Or do you mean great from
a "practical" perspective? Because I find them to be a long, long way
from "great". Sometimes I don't understand what reality I live in. Blame
the ganja wafting over me from all quarters now, I guess. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Function graphics axis range - how to get it consistently? [message #87870 is a reply to message #87868] Fri, 28 February 2014 10:34 Go to previous messageGo to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Oh my God, check this out:

I added print statements before and after the various plot/text calls
like so:

print, tp[0].YRANGE
c = PLOT( [date_time[idx[i]],date_time[idx[i]]], tp[0].YRANGE, $
XTICKFORMAT='LABEL_DATE', $
LINESTYLE='dashed', $
/OVERPLOT, $
BUFFER=buffer )
print, tp[0].YRANGE
t = TEXT( date_time[idx[i]], (tp[0].YRANGE)[1], $
comment[idx[i]], $
FONT_SIZE=7, $
/DATA, $
TARGET=tp[0], $
ALIGNMENT=0.5, $
VERTICAL_ALIGNMENT=1.0 )
print, tp[0].YRANGE


This is the output:

0.0000000 350.00000
0.0000000 400.00000
0.0000000 400.00000

So the PLOT() command uses the "busted" YRANGE property value, but doing
so "fixes" it.

WTF?

I give up.

On 02/28/14 13:18, David Fanning wrote:
> Paul van Delst writes:
>
>> To paraphrase Inigo Montoya, regarding the property YRANGE:
>> "You keep using that word. I do not think it means what you think it means."
>
> It has been one of those days. (Well, honestly, it has been one of those
> weeks.) I finally got a chance to take a shower a few minutes ago and I
> was thinking as the hot water splashed over me, that as long as I was
> asking philosophical questions that remain unanswered, here is another.
> When you say:
>
> "For the record, I use FG pretty much exclusively.
> I think they're great."
>
> Do you mean great from an "idea" perspective? Or do you mean great from
> a "practical" perspective? Because I find them to be a long, long way
> from "great". Sometimes I don't understand what reality I live in. Blame
> the ganja wafting over me from all quarters now, I guess. :-)

Albert Einstein — 'In theory, theory and practice are the same. In
practice, they are not.'

Grr argghh!
Re: Function graphics axis range - how to get it consistently? [message #87872 is a reply to message #87870] Fri, 28 February 2014 11:00 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Friday, February 28, 2014 11:34:05 AM UTC-7, Paul van Delst wrote:
> Oh my God, check this out:
>
>
>
> I added print statements before and after the various plot/text calls
>
> like so:
>
>
>
> print, tp[0].YRANGE
>
> c = PLOT( [date_time[idx[i]],date_time[idx[i]]], tp[0].YRANGE, $
>
> XTICKFORMAT='LABEL_DATE', $
>
> LINESTYLE='dashed', $
>
> /OVERPLOT, $
>
> BUFFER=buffer )
>
> print, tp[0].YRANGE
>
> t = TEXT( date_time[idx[i]], (tp[0].YRANGE)[1], $
>
> comment[idx[i]], $
>
> FONT_SIZE=7, $
>
> /DATA, $
>
> TARGET=tp[0], $
>
> ALIGNMENT=0.5, $
>
> VERTICAL_ALIGNMENT=1.0 )
>
> print, tp[0].YRANGE
>
>
>
>
>
> This is the output:
>
>
>
> 0.0000000 350.00000
>
> 0.0000000 400.00000
>
> 0.0000000 400.00000
>
>
>
> So the PLOT() command uses the "busted" YRANGE property value, but doing
>
> so "fixes" it.
>
>
>
> WTF?
>
>
>
> I give up.
>
>
>
> On 02/28/14 13:18, David Fanning wrote:
>
>> Paul van Delst writes:
>
>>
>
>>> To paraphrase Inigo Montoya, regarding the property YRANGE:
>
>>> "You keep using that word. I do not think it means what you think it means."
>
>>
>
>> It has been one of those days. (Well, honestly, it has been one of those
>
>> weeks.) I finally got a chance to take a shower a few minutes ago and I
>
>> was thinking as the hot water splashed over me, that as long as I was
>
>> asking philosophical questions that remain unanswered, here is another.
>
>> When you say:
>
>>
>
>> "For the record, I use FG pretty much exclusively.
>
>> I think they're great."
>
>>
>
>> Do you mean great from an "idea" perspective? Or do you mean great from
>
>> a "practical" perspective? Because I find them to be a long, long way
>
>> from "great". Sometimes I don't understand what reality I live in. Blame
>
>> the ganja wafting over me from all quarters now, I guess. :-)
>
>
>
> Albert Einstein -- 'In theory, theory and practice are the same. In
>
> practice, they are not.'
>
>
>
> Grr argghh!

Hi Paul,

I don't think you need to use a PLOT to do your dashed line. When you do an overplot, it's going to try to update the range to fit your new plot line. Instead, you could just use a polyline:

IDL> p = plot(/test, xrange=[0,250], yrange=[-1,2])
IDL> p1 = polyline([200,200],p.yrange, /data, linestyle='dashed')

Hope this helps.
Cheers,
Chris
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Orientation of Contour Labels
Next Topic: Mavericks: NG plots start out black

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

Current Time: Wed Oct 08 13:47:07 PDT 2025

Total time taken to generate the page: 0.00643 seconds