<div dir="ltr">Hi Melissa,<div>There are numerous ways to go about it, including setting the <a href="https://www.ncl.ucar.edu/Applications/tickmarks.shtml#ex2" target="_blank">tmXBMode/tmXBValues/tmXBLabels</a> resources. In this particular case though, it is likely easiest to just modify the specified x-axis values in the plot call. Try changing this:</div><div>plot1=gsn_csm_xy(wks,pr&time,pr(:,0,0),res)<br></div><div>to this:</div><div>plot1=gsn_csm_xy(wks,ispan(1856,1890,1),pr(:,0,0),res)<br></div><div><br></div><div>If you want to change the labels themselves you will have to use the tmXBMode/tmXBValues/tmXBLabels resources. The values input to tmXBValues must be in the range of values specified in your x-axis input in the plot call. For example, this will work:</div><div><br></div><div>res@tmXBMode = "Explicit"</div><div>res@tmXBValues = (/1860,1870,1880,1890/)</div><div>res@tmXBLabels = res@tmXBValues</div><div>plot1=gsn_csm_xy(wks,ispan(1856,1890,1),pr(:,0,0),res)<br></div><div><br></div><div>but this will not:</div><div><div>res@tmXBMode = "Explicit"</div><div>res@tmXBValues = (/1860,1870,1880,1890/)</div><div>res@tmXBLabels = res@tmXBValues</div><div><div>plot1=gsn_csm_xy(wks,pr&time,pr(:,0,0),res)<br></div><div><br></div><div>Finally, if you set tmXBMode = "Explicit" you will lose the minor tick marks. To get them back, set tmXBMinorValues.</div><div><br></div><div>Hope that helps!</div><div>Adam</div><div></div></div></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Nov 16, 2022 at 4:38 AM Melissa Lazenby via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Dear All NCL Users</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
I am having trouble displaying my x-axis correctly for an XY plot with precip anomalies vs time. </div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Below is the figure and code:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<img style="width: 578px; height: 524px; max-width: initial;" width="578" height="524" size="57655" src="cid:18481598e51cb971f161"><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
I just would like to have my x-axis represent my time data which is in years from 1856-1890.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Any help would be greatly appreciated.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
;************************************************
<div>; Concepts illustrated:<br>
</div>
<div>; - Drawing a xyplot</div>
<div>;************************************************</div>
<div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
</div>
<div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
</div>
<div>;************************************************</div>
<div>begin</div>
<div>;************************************************</div>
<div>; variable and file handling</div>
<div>;************************************************</div>
<div> in = addfile("/mnt/geog/ml382/ml382_sals000408_home_dir/melsicz/mpwapwa/ENSMEAN/pr_Amon_ENSMEAN_historical_mpwapwa_1856-1890_NDJFMA_NEW_ANOM_YMONMEAN.nc","r") </div>
<div><br>
</div>
<div> pr = in->pr(:,0,:,:)</div>
<div><br>
</div>
<div> print(pr)</div>
<div> </div>
<div>;************************************************<br>
</div>
<div>; plotting</div>
<div>;************************************************</div>
<div> wks = gsn_open_wks("X11","Figure_Mpwapwa_20CR") ; Opens a ps file
</div>
<div> </div>
<div> res = True </div>
<div> res@gsnMaximize = True</div>
<div> res@tiXAxisString = "Years 1856-1890 (NDJFMA)" ; x-axis label</div>
<div> res@tiYAxisString = "Precipitation Anomaly" ; y-axis label</div>
<div> res@xyLineLabelsOn = True ; no contour line labels</div>
<div> ;res@trXMinF = 1856 ; min level</div>
<div> ;res@trXMaxF = 1890 ; max level</div>
<div> res@xyLineThicknessF = 4.0</div>
<div> res@lgLineThicknessF = 2.0</div>
<div><br>
</div>
<div> res@gsnDraw = False ; do not draw the plot</div>
<div> res@gsnFrame = False </div>
<div> ;res@pmLegendDisplayMode = "Always" ; Display a legend. </div>
<div> </div>
<div> res@pmLegendParallelPosF = 1.25 ; move units right</div>
<div> res@pmLegendOrthogonalPosF = -0.9 ; move units down
</div>
<div> res@lgBoxMinorExtentF = 0.3</div>
<div> res@pmLegendWidthF = 0.1</div>
<div> res@lgLabelFontHeightF = 0.015 ; Change the font size</div>
<div> res@pmLegendHeightF = 0.2</div>
<div> </div>
<div>res@gsnXYBarChart = True<br>
</div>
<div> res@xyLineColors = (/"blue", "red"/)</div>
<div>res@tiMainString = "CMIP5 ENSMEAN Precipitation Anomalies over Mpwapwa"</div>
<div> res@gsnYRefLine = 0. ; reference line
</div>
<div><br>
</div>
<div> </div>
<div>plot1=gsn_csm_xy(wks,pr&time,pr(:,0,0),res)</div>
<div><br>
</div>
<div> draw(plot1)</div>
<div> frame(wks)</div>
<div><br>
</div>
<div>end</div>
<div><br>
</div>
<div><span style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">Kindest Regards</span><br>
</div>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Melissa</div>
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div id="m_-160161484449285697m_-7109937629689567121Signature">
<div>
<div style="font-family:Tahoma;font-size:13px"></div>
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">Dr. Melissa Lazenby
<div>Lecturer in Climate Change</div>
<div>Department of Geography</div>
<div>Chichester 1 C150</div>
<div>University of Sussex</div>
<div><br>
</div>
<div><i style="color:inherit;font-family:inherit;font-size:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit">"Education is the most powerful weapon which you can use to change the world" Nelson Mandela</i><br>
</div>
<div><i style="color:inherit;font-family:inherit;font-size:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit"><br>
</i></div>
<div><i style="color:inherit;font-family:inherit;font-size:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit"><img style="max-width: 100%;" src="cid:18481598e517d5783fb2"><br>
</i></div>
</div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist IV, Climate Analysis Section</font></span></div><div><span><font color="#888888">Climate and Global Dynamics Laboratory<br></font></span></div></div><div><span style="color:rgb(136,136,136)">National Center for Atmospheric Research</span><span><font color="#888888"><br></font></span></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>