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

Home » Public Forums » archive » Plot with X-Axis ticks as string
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
Plot with X-Axis ticks as string [message #92622] Tue, 26 January 2016 04:58 Go to next message
Kai is currently offline  Kai
Messages: 1
Registered: January 2016
Junior Member
Hello everyone!

I'd like to plot monthly values of a parameter. The months go from Arpil to November. How can I implement ticks at the x-axis which are simple strings, e.g. 'Apr', 'May' .....

So I plotted something and I tried to add a fitted x-axis to the plot as follows:

myplot_c1 = PLOT(parameters, NAME='Cluster',COLOR='red',XTEXT_COLOR='white', YSTYLE=2, XSTYLE=3, YTITLE='Parameter',MIN_VALUE=-1, MAX_VALUE=1, XTICKINTERVAL=1,YRANGE=[0.15,0.5])

xax = AXIS('X',LOCATION=[0,0.15],TICKVALUES=['Mar','Apr','May','Ju n','Jul','Aug','Sep','Oct'], MINOR=1, MAJOR=-1, TICKLEN=0.015,TICKFONT_SIZE=11,TICKINTERVAL=1)

Somehow the monthly ticks just won't appear.

Any suggestions?

Cheers,
Kai
Re: Plot with X-Axis ticks as string [message #92642 is a reply to message #92622] Sun, 31 January 2016 01:44 Go to previous messageGo to next message
Kai Heckel is currently offline  Kai Heckel
Messages: 51
Registered: April 2015
Member
Am Dienstag, 26. Januar 2016 13:58:30 UTC+1 schrieb Kai:
> Hello everyone!
>
> I'd like to plot monthly values of a parameter. The months go from Arpil to November. How can I implement ticks at the x-axis which are simple strings, e.g. 'Apr', 'May' .....
>
> So I plotted something and I tried to add a fitted x-axis to the plot as follows:
>
> myplot_c1 = PLOT(parameters, NAME='Cluster',COLOR='red',XTEXT_COLOR='white', YSTYLE=2, XSTYLE=3, YTITLE='Parameter',MIN_VALUE=-1, MAX_VALUE=1, XTICKINTERVAL=1,YRANGE=[0.15,0.5])
>
> xax = AXIS('X',LOCATION=[0,0.15],TICKVALUES=['Mar','Apr','May','Ju n','Jul','Aug','Sep','Oct'], MINOR=1, MAJOR=-1, TICKLEN=0.015,TICKFONT_SIZE=11,TICKINTERVAL=1)
>
> Somehow the monthly ticks just won't appear.
>
> Any suggestions?
>
> Cheers,
> Kai

Does no one have any suggestions?

Regards,
Kai
Re: Plot with X-Axis ticks as string [message #92645 is a reply to message #92642] Mon, 01 February 2016 08:26 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
Hello,

Have a look at:

http://www.exelisvis.com/docs/LABEL_DATE.html


Also, playing around with user-defined functions for tick labeling might
be useful (although I think the above is what you need). See:

http://www.exelisvis.com/docs/graphkeyw.html#graphkeyw_32887 78166_370350

in particular the section titled: "The name of a user-defined function:"

cheers,

paulv

On 01/31/16 04:44, Kai Heckel wrote:
> Am Dienstag, 26. Januar 2016 13:58:30 UTC+1 schrieb Kai:
>> Hello everyone!
>>
>> I'd like to plot monthly values of a parameter. The months go from
>> Arpil to November. How can I implement ticks at the x-axis which
>> are simple strings, e.g. 'Apr', 'May' .....
>>
>> So I plotted something and I tried to add a fitted x-axis to the
>> plot as follows:
>>
>> myplot_c1 = PLOT(parameters,
>> NAME='Cluster',COLOR='red',XTEXT_COLOR='white', YSTYLE=2, XSTYLE=3,
>> YTITLE='Parameter',MIN_VALUE=-1, MAX_VALUE=1,
>> XTICKINTERVAL=1,YRANGE=[0.15,0.5])
>>
>> xax =
>> AXIS('X',LOCATION=[0,0.15],TICKVALUES=['Mar','Apr','May','Ju n','Jul','Aug','Sep','Oct'],
>> MINOR=1, MAJOR=-1, TICKLEN=0.015,TICKFONT_SIZE=11,TICKINTERVAL=1)
>>
>> Somehow the monthly ticks just won't appear.
>>
>> Any suggestions?
>>
>> Cheers, Kai
>
> Does no one have any suggestions?
>
> Regards, Kai
>
Re: Plot with X-Axis ticks as string [message #92646 is a reply to message #92645] Mon, 01 February 2016 08:31 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
Actually, since you're using function graphics, have a look at the C()
format codes:
http://www.exelisvis.com/docs/format_codes.html#files_283972 0996_2823814

But, again, I think label_date() is what you need.

For example in some of my code I do:

; Set up the date labeling
date_label = LABEL_DATE(DATE_FORMAT='%D %M!C%Y')

and then

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', $
/XSTYLE, $
...etc...

See the value for XTICKFORMAT?

cheers,

paulv

On 02/01/16 11:26, Paul van Delst wrote:
> Hello,
>
> Have a look at:
>
> http://www.exelisvis.com/docs/LABEL_DATE.html
>
>
> Also, playing around with user-defined functions for tick labeling might
> be useful (although I think the above is what you need). See:
>
> http://www.exelisvis.com/docs/graphkeyw.html#graphkeyw_32887 78166_370350
>
> in particular the section titled: "The name of a user-defined function:"
>
> cheers,
>
> paulv
>
> On 01/31/16 04:44, Kai Heckel wrote:
>> Am Dienstag, 26. Januar 2016 13:58:30 UTC+1 schrieb Kai:
>>> Hello everyone!
>>>
>>> I'd like to plot monthly values of a parameter. The months go from
>>> Arpil to November. How can I implement ticks at the x-axis which
>>> are simple strings, e.g. 'Apr', 'May' .....
>>>
>>> So I plotted something and I tried to add a fitted x-axis to the
>>> plot as follows:
>>>
>>> myplot_c1 = PLOT(parameters,
>>> NAME='Cluster',COLOR='red',XTEXT_COLOR='white', YSTYLE=2, XSTYLE=3,
>>> YTITLE='Parameter',MIN_VALUE=-1, MAX_VALUE=1,
>>> XTICKINTERVAL=1,YRANGE=[0.15,0.5])
>>>
>>> xax =
>>> AXIS('X',LOCATION=[0,0.15],TICKVALUES=['Mar','Apr','May','Ju n','Jul','Aug','Sep','Oct'],
>>>
>>> MINOR=1, MAJOR=-1, TICKLEN=0.015,TICKFONT_SIZE=11,TICKINTERVAL=1)
>>>
>>> Somehow the monthly ticks just won't appear.
>>>
>>> Any suggestions?
>>>
>>> Cheers, Kai
>>
>> Does no one have any suggestions?
>>
>> Regards, Kai
>>
Re: Plot with X-Axis ticks as string [message #92648 is a reply to message #92646] Mon, 01 February 2016 10:23 Go to previous messageGo to next message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le lundi 1 février 2016 17:31:54 UTC+1, Paul van Delst a écrit :
> Actually, since you're using function graphics, have a look at the C()
> format codes:
> http://www.exelisvis.com/docs/format_codes.html#files_283972 0996_2823814
>
> But, again, I think label_date() is what you need.
>
> For example in some of my code I do:
>
> ; Set up the date labeling
> date_label = LABEL_DATE(DATE_FORMAT='%D %M!C%Y')
>
> and then
>
> 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', $
> /XSTYLE, $
> ...etc...
>
> See the value for XTICKFORMAT?
>
> cheers,
>
> paulv
>
> On 02/01/16 11:26, Paul van Delst wrote:
>> Hello,
>>
>> Have a look at:
>>
>> http://www.exelisvis.com/docs/LABEL_DATE.html
>>
>>
>> Also, playing around with user-defined functions for tick labeling might
>> be useful (although I think the above is what you need). See:
>>
>> http://www.exelisvis.com/docs/graphkeyw.html#graphkeyw_32887 78166_370350
>>
>> in particular the section titled: "The name of a user-defined function:"
>>
>> cheers,
>>
>> paulv
>>
>> On 01/31/16 04:44, Kai Heckel wrote:
>>> Am Dienstag, 26. Januar 2016 13:58:30 UTC+1 schrieb Kai:
>>>> Hello everyone!
>>>>
>>>> I'd like to plot monthly values of a parameter. The months go from
>>>> Arpil to November. How can I implement ticks at the x-axis which
>>>> are simple strings, e.g. 'Apr', 'May' .....
>>>>
>>>> So I plotted something and I tried to add a fitted x-axis to the
>>>> plot as follows:
>>>>
>>>> myplot_c1 = PLOT(parameters,
>>>> NAME='Cluster',COLOR='red',XTEXT_COLOR='white', YSTYLE=2, XSTYLE=3,
>>>> YTITLE='Parameter',MIN_VALUE=-1, MAX_VALUE=1,
>>>> XTICKINTERVAL=1,YRANGE=[0.15,0.5])
>>>>
>>>> xax =
>>>> AXIS('X',LOCATION=[0,0.15],TICKVALUES=['Mar','Apr','May','Ju n','Jul','Aug','Sep','Oct'],
>>>>
>>>> MINOR=1, MAJOR=-1, TICKLEN=0.015,TICKFONT_SIZE=11,TICKINTERVAL=1)
>>>>
>>>> Somehow the monthly ticks just won't appear.
>>>>
>>>> Any suggestions?
>>>>
>>>> Cheers, Kai
>>>
>>> Does no one have any suggestions?
>>>
>>> Regards, Kai
>>>

If your time variable is expressed in Julian days, you can even put a C format string in the TICKFORMAT keyword. For instance, with :
pl = plot(jd, x, ..., XTICKFORMAT='(C(CYI4.4,"/",CMOI2.2,"/",CDI2.2))',...)
you get axis times such as 2016/02/01.
alx.
Re: Plot with X-Axis ticks as string [message #92649 is a reply to message #92648] Mon, 01 February 2016 10:37 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
On 02/01/16 13:23, alx wrote:
>
> If your time variable is expressed in Julian days, you can even put
> aC format string in the TICKFORMAT keyword. For instance, with :
> pl = plot(jd, x, ..., XTICKFORMAT='(C(CYI4.4,"/",CMOI2.2,"/",CDI2.2))',...)
> you get axis times such as 2016/02/01.
> alx.

Inline!

Très cool.
Re: Plot with X-Axis ticks as string [message #93016 is a reply to message #92645] Sun, 10 April 2016 11:16 Go to previous message
Charlie Roberts is currently offline  Charlie Roberts
Messages: 3
Registered: April 2016
Junior Member
On Mon, 1 Feb 2016 11:26:24 -0500, Paul van Delst
<paul.vandelst@noaa.gov> wrote:


> On 01/31/16 04:44, Kai Heckel wrote:
>> Am Dienstag, 26. Januar 2016 13:58:30 UTC+1 schrieb Kai:
>>> Hello everyone!
>>>
>>> I'd like to plot monthly values of a parameter. The months go from
>>> Arpil to November. How can I implement ticks at the x-axis which
>>> are simple strings, e.g. 'Apr', 'May' .....
>>>

How about reading the User's Guide? You can even get it on the net.

Page 58 of the User's Guide to PV Wave 7.5.

Example 1: Specifying Tick Labels and Values

and also

Example 2: Specifying Tick Lengths

on pp. 59-60.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: assigning integer and string value to same variable one by one
Next Topic: Nice bridges

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

Current Time: Wed Oct 08 09:10:47 PDT 2025

Total time taken to generate the page: 0.00476 seconds