[ncl-talk] How to change color bar for the second field using gsnHistogramCompare
rK Aditya
aditya.rk at gmail.com
Sun May 15 13:11:21 MDT 2016
Dear All,
I would like to compare histogram for two seasons; winter and summer. I use
the first field for summer and put it with filled red color. But I could
not change the color in the second field, on crosshatch pattern to other
color, let say blue.
If someone can help me?
Thank you for your time.
Kindest regards,
-r/K-
begin
;************************************************
; Generate some random data.
;************************************************
x = new(1000,integer)
y = new(1000,integer)
do i=0,dimsizes(x)-1
x(i) = rand()
y(i) = rand()
end do
x = x/320
y = y/320
;************************************************
; Set up a variable to hold both x and y.
;************************************************
z = new((/2,dimsizes(x)/),integer)
z(0,:) = x
z(1,:) = y
;************************************************
; create plot
;************************************************
wks = gsn_open_wks("png","histo") ; send graphics to PNG file
gsn_define_colormap(wks,"temp1") ; choose colormap
res = True ; plot mods desired
res at gsnHistogramCompare = True
res at gsnHistogramBinIntervals = (/25,50,75/)
; res at gsFillColors = (/(/"blue","red"/),(/"blue","red"/)/)
; res at gsFillColor=(/"blue","blue","red","red"/)
res at gsnHistogramBarColors = (/(/"red","blue"/),(/"red","blue"/)/)
; res at gsnHistogramBarColors=(/"blue","blue","red","red"/)
plot=gsn_histogram(wks,z,res) ; create histogram
end
[image: Inline image 1]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160515/39b29876/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: histo.png
Type: image/png
Size: 70341 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160515/39b29876/attachment.png
More information about the ncl-talk
mailing list