[ncl-talk] scale issues in a csm_XY2 plotting
Karin Meier-Fleischer
meier-fleischer at dkrz.de
Wed Dec 8 00:32:24 MST 2021
Hi Jason,
the y-axis ranges should be set for all plots. In the script below (I
threw out everything that is not needed for readability) trYMinF,
trYMaxF for the left and right y-axis is set for all plots. It should go
like this.
-Karin
begin
f0 = "County001-SO2-0012-2013-18full-line.txt"
f1 = "County013-SO2-0006-2013-18full-line.txt"
f2 = "County027-SO2-0007-2013-18full-line.txt"
f3 = "County029-SO2-0002-2013-18full-line.txt"
f4 = "County031-SO2-0003-2013-18full-line.txt"
f5 = "County043-SO2-0005-2013-18full-line.txt"
f6 = "County055-SO2-1007-2013-18full-line.txt"
f7 = "County067-SO2-1015-2013-18full-line.txt"
f8 = "County081-SO2-0124-2013-18full-line.txt"
f9 = "County101-SO2-0003-2013-18full-line.txt"
f10 = "County103-SO2-0009-2013-18full-line.txt"
data0 = asciiread(f0,(/2191,3/),"double")
data1 = asciiread(f1,(/2191,3/),"double")
data2 = asciiread(f2,(/2191,3/),"double")
data3 = asciiread(f3,(/2191,3/),"double")
data4 = asciiread(f4,(/2191,3/),"double")
data5 = asciiread(f5,(/2191,3/),"double")
data6 = asciiread(f6,(/2191,3/),"double")
data7 = asciiread(f7,(/2191,3/),"double")
data8 = asciiread(f8,(/2191,3/),"double")
data9 = asciiread(f9,(/2191,3/),"double")
data10 = asciiread(f10,(/2191,3/),"double")
xlabelc = (/"2013","2014","2015","2016","2017","2018"/)
; DEC-GEOS dates in
x0 = data0(:,0)
x1 = data1(:,0)
x2 = data2(:,0)
x3 = data3(:,0)
x4 = data4(:,0)
x5 = data5(:,0)
x6 = data6(:,0)
x7 = data7(:,0)
x8 = data8(:,0)
x9 = data9(:,0)
x10 = data10(:,0)
; DEC data in
y0 = data0(:,1)
y0 at _FillValue=integertoshort(-999)
y0=where(y0.lt.-5.0,y0 at FillValue,y0)
y1 = data1(:,1)
y1 at _FillValue=integertoshort(-999)
y1=where(y1.lt.-5.0,y1 at FillValue,y1)
y2 = data2(:,1)
y2 at _FillValue=integertoshort(-999)
y2=where(y2.lt.-5.0,y2 at FillValue,y2)
y3 = data3(:,1)
y3 at _FillValue=integertoshort(-999)
y3=where(y3.lt.-5.0,y3 at FillValue,y3)
y4 = data4(:,1)
y4 at _FillValue=integertoshort(-999)
y4=where(y4.lt.-5.0,y4 at FillValue,y4)
y5 = data5(:,1)
y5 at _FillValue=integertoshort(-999)
y5=where(y5.lt.-5.0,y5 at FillValue,y5)
y6 = data6(:,1)
y6 at _FillValue=integertoshort(-999)
y6=where(y6.lt.-5.0,y6 at FillValue,y6)
y7 = data7(:,1)
y7 at _FillValue=integertoshort(-999)
y7=where(y7.lt.-5.0,y7 at FillValue,y7)
y8 = data8(:,1)
y8 at _FillValue=integertoshort(-999)
y8=where(y8.lt.-5.0,y8 at FillValue,y8)
y9 = data9(:,1)
y9 at _FillValue=integertoshort(-999)
y9=where(y9.lt.-5.0,y9 at FillValue,y9)
y10 = data10(:,1)
y10 at _FillValue=integertoshort(-999)
y10=where(y10.lt.-5.0,y10 at FillValue,y10)
; GEOS-Chem data in
GCD0 = data0(:,2)
GCD0 at _FillValue=integertoshort(-999)
GCD0=where(GCD0.lt.-5.0,GCD0 at FillValue,GCD0)
GCD1 = data1(:,2)
GCD1 at _FillValue=integertoshort(-999)
GCD1=where(GCD1.lt.-5.0,GCD1 at FillValue,GCD1)
GCD2 = data2(:,2)
GCD2 at _FillValue=integertoshort(-999)
GCD2=where(GCD2.lt.-5.0,GCD2 at FillValue,GCD2)
GCD3 = data3(:,2)
GCD3 at _FillValue=integertoshort(-999)
GCD3=where(GCD3.lt.-5.0,GCD3 at FillValue,GCD3)
GCD4 = data4(:,2)
GCD4 at _FillValue=integertoshort(-999)
GCD4=where(GCD4.lt.-5.0,GCD4 at FillValue,GCD4)
GCD5 = data5(:,2)
GCD5 at _FillValue=integertoshort(-999)
GCD5=where(GCD5.lt.-5.0,GCD5 at FillValue,GCD5)
GCD6 = data6(:,2)
GCD6 at _FillValue=integertoshort(-999)
GCD6=where(GCD6.lt.-5.0,GCD6 at FillValue,GCD6)
GCD7 = data7(:,2)
GCD7 at _FillValue=integertoshort(-999)
GCD7=where(GCD7.lt.-5.0,GCD7 at FillValue,GCD7)
GCD8 = data8(:,2)
GCD8 at _FillValue=integertoshort(-999)
GCD8=where(GCD8.lt.-5.0,GCD8 at FillValue,GCD8)
GCD9 = data9(:,2)
GCD9 at _FillValue=integertoshort(-999)
GCD9=where(GCD9.lt.-5.0,GCD9 at FillValue,GCD9)
GCD10 = data10(:,2)
GCD10 at _FillValue=integertoshort(-999)
GCD10=where(GCD10.lt.-5.0,GCD10 at FillValue,GCD10)
;************************************************
; create plots
;************************************************
plot = new(11,graphic)
wks = gsn_open_wks("png","SO2_Multisite_plot.png") ; ps,pdf,x11,png
trxmin = 2013 ; min/max values for X axis
trxmax = 2018
trymin = -2.
trymax = 8.
trymin2 = 0.
trymax2 = 8.
res = True ; plot mods desired
res at gsnDraw = False
res at gsnFrame = False
res at vpWidthF = 0.70 ; change aspect ratio of plot
res at vpHeightF = 0.25
res at trXMinF = trxmin
res at trXMaxF = trxmax
res at trXReverse = False ; Reverse X axis values
res at trYMinF = trymin2
res at trYMaxF = trymax2
res at xyLineThicknessF = 2.0
res at xyLineColor = (/"Red"/)
res1 = res
res2 = res
res3 = res
res4 = res
res5 = res
res6 = res
res7 = res
res8 = res
res9 = res
res10 = res
res11 = res
res12 = res
res at xyLineColor = (/"Black"/)
res at trYMinF = trymin
res at trYMaxF = trymax
res12 at xyLineColor = (/"Black"/)
;**************************************************************************
res at tiYAxisString = "SO2 (ppb)"
res at tiYAxisFontColor = res at xyLineColor
res at tiYAxisFontHeightF = 0.05
res at tmXBOn = False
plot(0) = gsn_csm_xy2 (wks,x0,y0,GCD0,res,res1) ; create plot
plot(1) = gsn_csm_xy2 (wks,x1,y1,GCD1,res,res3) ; create plot
plot(2) = gsn_csm_xy2 (wks,x2,y2,GCD2,res,res4) ; create plot
plot(3) = gsn_csm_xy2 (wks,x3,y3,GCD3,res,res12) ; create plot
plot(4) = gsn_csm_xy2 (wks,x4,y4,GCD4,res,res5) ; create plot
plot(5) = gsn_csm_xy2 (wks,x5,y5,GCD5,res,res6) ; create plot
plot(6) = gsn_csm_xy2 (wks,x6,y6,GCD6,res,res7) ; create plot
plot(7) = gsn_csm_xy2 (wks,x7,y7,GCD7,res,res8) ; create plot
plot(8) = gsn_csm_xy2 (wks,x8,y8,GCD8,res,res9) ; create plot
plot(9) = gsn_csm_xy2 (wks,x9,y9,GCD9,res,res10) ; create plot
plot(10) = gsn_csm_xy2 (wks,x10,y10,GCD10,res,res11) ; create plot
gsn_panel(wks,plot,(/6,2/),False)
end
Am 08.12.21 um 01:48 schrieb Herb, Jason via ncl-talk:
> Hello All,
>
> I am attempting to do a series of plots together; Black lines are
> surface observations and red lines are model simulation. The issue I
> am having is that each plot separate box plot should have the same
> scale as the upper right most plot. However, NCL is putting varying
> scale ranges as can be seen in the attached plot. Is there a simpler
> way for this to be done automatically by NCL than doing the ranges by
> hand? As I have other plots will be of similar style. I have attached
> the script as well.
>
> Thanks,
> Jason
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
--
Dipl. Geophys. Karin Meier-Fleischer
Visualization Group - NCL, CDO, Python
Application Support
Deutsches Klimarechenzentrum GmbH (DKRZ)
Bundesstrasse 45a - D-20146 Hamburg - Germany
Phone: +49 (0)40 460094 126
Fax: +49 (0)40 460094 270
E-Mail:meier-fleischer at dkrz.de
URL:www.dkrz.de
Geschäftsführer: Prof. Dr. Thomas Ludwig
Sitz der Gesellschaft: Hamburg
Amtsgericht Hamburg HRB 39784
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20211208/f82a0a14/attachment.html>
More information about the ncl-talk
mailing list