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

Home » Public Forums » archive » Re: PLOT axis labels
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
Re: PLOT axis labels [message #53191] Fri, 30 March 2007 08:36
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
grafgeo@hotmail.com writes:

> I try to get a plot with only major xticks, but only every other
> should be labelled (i.e. every year should have a tick (it is a dotted
> vertical line), but only the lines of the even years should be
> labelled). How can I do this?
>
> ;date_arr consists of [julian day, y-value]
>
> date_label = LABEL_DATE(DATE_FORMAT = ['%Y'])
> PLOT, date_arr[0,*], date_arr[1,*], xtickunit='YEARS',
> xtickformat='Label_Date', $
> xticks=n_elements(x_values)-1, xticklen=1, xminor=1, xgridstyle=1

Yikes! I did it like this:

Function EveryOtherYear, axisIn, indexIn, valueIn, levelIn, $
AM_PM = am_pm, $
DATE_FORMAT = dateFormat, $
DAYS_OF_WEEK = days_of_week, $
MONTHS = months, $
OFFSET = offs, $
ROUND_UP = round_up
value = LABEL_DATE(axisIn, indexIn, valueIn, levelIn, $
AM_PM = am_pm, $
DATE_FORMAT = dateFormat, $
DAYS_OF_WEEK = days_of_week, $
MONTHS = months, $
OFFSET = offs, $
ROUND_UP = round_up)
IF Long(value) MOD 2 EQ 1 THEN RETURN, "" ELSE RETURN, value
END


date_arr = dblarr(2,10)
date_arr[0,*] = timegen(10)*360 + julday()
date_arr[1,*] = randomu(-3L, 10)
date_label = LABEL_DATE(DATE_FORMAT = ['%Y'])
PLOT, date_arr[0,*], date_arr[1,*], xtickunit='YEARS', $
xticks=9, xticklen=1, xminor=1, xgridstyle=1, $
xtickformat='EveryOtherYear'

END

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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: simple question (I hope)
Next Topic: IDLWAVE quickie

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

Current Time: Thu Oct 09 21:14:24 PDT 2025

Total time taken to generate the page: 1.14080 seconds