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

Home » Public Forums » archive » Custom X Aix with Barplot
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
Custom X Aix with Barplot [message #92229] Mon, 02 November 2015 13:33 Go to next message
tballinger6 is currently offline  tballinger6
Messages: 3
Registered: April 2013
Junior Member
Hi All,

Using IDL 8.5, I've tried to plot the following data with custom barplot labels indicating each month (listed by "labels" array) below each corresponding bar, but instead of month labels my graphic shows 0-12 under each bar. Any tips on correcting this based on my code below?


FULL = [5229.22, 5231.94, 5248.80, 5307.62, 5428.88, 5533.35, 5595.26, 5561.39,$ 5452.43, 5321.89, 5252.18, 5225.34]

;Months are commented out within script
;Months = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

Labels = ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D']

; Define the first barplot and the axes and titles
b1 = BARPLOT(FULL, Labels, INDEX=0, NBARS=4, FILL_COLOR='gold', YRANGE=[5200,$ 5700], YMINOR=0, YTITLE='Geopotential Heights (m)', XTITLE='Months', TITLE='')


Thanks,

Tom
Re: Custom X Aix with Barplot [message #92241 is a reply to message #92229] Wed, 04 November 2015 14:12 Go to previous messageGo to next message
zacharyanorman is currently offline  zacharyanorman
Messages: 17
Registered: July 2015
Junior Member
Hi Tom,


Here is an easy way that I can think of to do this:

FULL = [5229.22, 5231.94, 5248.80, 5307.62, 5428.88, $
5533.35, 5595.26, 5561.39, 5452.43, 5321.89, 5252.18, 5225.34]

;Months are commented out within script
monthnumber = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

; Define the first barplot and the axes and titles
b1 = BARPLOT(monthnumber, FULL, FILL_COLOR='gold', $
YRANGE=[5200, 5700], YMINOR=0, YTITLE='Geopotential Heights (m)', $
XTITLE='Months', XMAJOR = 14, xminor = 0, TITLE='', XRANGE = [0,13])

;manually replace the ticknames (labels)
ticklabels =['','J', 'F', 'M', 'A', 'M', $
'J', 'J', 'A', 'S', 'O', 'N', 'D','']
xaxis = (b1.axes)[0]
xaxis.tickname = ticklabels

The idea is just to replace the ticknames for the x axis with the abbreviations for the months of the year. Hope this helps!

-Zach (Exelis VIS)
Re: Custom X Aix with Barplot [message #92271 is a reply to message #92241] Mon, 09 November 2015 06:21 Go to previous message
tballinger6 is currently offline  tballinger6
Messages: 3
Registered: April 2013
Junior Member
On Wednesday, November 4, 2015 at 4:12:48 PM UTC-6, Zachary Norman wrote:
> Hi Tom,
>
>
> Here is an easy way that I can think of to do this:
>
> FULL = [5229.22, 5231.94, 5248.80, 5307.62, 5428.88, $
> 5533.35, 5595.26, 5561.39, 5452.43, 5321.89, 5252.18, 5225.34]
>
> ;Months are commented out within script
> monthnumber = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
>
> ; Define the first barplot and the axes and titles
> b1 = BARPLOT(monthnumber, FULL, FILL_COLOR='gold', $
> YRANGE=[5200, 5700], YMINOR=0, YTITLE='Geopotential Heights (m)', $
> XTITLE='Months', XMAJOR = 14, xminor = 0, TITLE='', XRANGE = [0,13])
>
> ;manually replace the ticknames (labels)
> ticklabels =['','J', 'F', 'M', 'A', 'M', $
> 'J', 'J', 'A', 'S', 'O', 'N', 'D','']
> xaxis = (b1.axes)[0]
> xaxis.tickname = ticklabels
>
> The idea is just to replace the ticknames for the x axis with the abbreviations for the months of the year. Hope this helps!
>
> -Zach (Exelis VIS)

Hi Zach,

That makes sense and helps a lot!

Thanks so much,

Tom
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: /XSTY not allowed in PLOT() call in V8.3
Next Topic: errors in robust_linefit

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

Current Time: Wed Oct 08 11:44:28 PDT 2025

Total time taken to generate the page: 0.00621 seconds