[ncl-talk] Unable to put labels on Xaxis and Y axis is elongated

Adam Phillips asphilli at ucar.edu
Wed Apr 28 09:49:25 MDT 2021


Hi Geeta,
To fix the Y-axis:
res at tmYLMode = "Explicit"
res at tmYLValues = ispan(1,18,1)
res at tmYLLabels = res at tmYLValues    ; or, depending on how you want the
formatting to be, tostring(res at tmYLValues)

For the Y-axis:
Make sure res at tmXBMode = "Explicit" is set. If it is, then the values you
are specifying in res at tmXBValues are likely not within the range of the
values of the array 1000*profile(:,Fix_NSCAN,153:193)).
To check, do this (after setting res at tmXBValues):
printMinMax(res at tmXBValues,0)
printMinMax(1000*profile(:,Fix_NSCAN,153:193)) ,0)

The two arrays ranges should overlap. If they do not, then the labels will
not show up.

If you continue to have issues please include your revised script, along
with the results of the prinMinMax statements above and respond to the
ncl-talk email list.
Adam





On Wed, Apr 28, 2021 at 8:25 AM Geeta Geeta <geetag54 at yahoo.com> wrote:

> Thanks for your mail Sir.
> I rectified/ added  the following  for Y axis.
>
>              res at trXAxisType    =  "IrregularAxis"
> ;             res at trXMinF       =   0
> ;             res at trXMaxF       =   40
>              res at trYMinF       = 0.5
>              res at trYMaxF       = 18.0
>
> For X axis ----
>
>
> res at tmXBValues    =
> (/longr(Fix_NSCAN,Fix_NP+20),longr(Fix_NSCAN,Fix_NP+16),longr(Fix_NSCAN,Fix_NP+12),longr(Fix_NSCAN,Fix_NP+08),longr(Fix_NSCAN,Fix_NP+04),longr(Fix_NSCAN,Fix_NP),longr(Fix_NSCAN,Fix_NP-04),
> longr(Fix_NSCAN,Fix_NP-08),longr(Fix_NSCAN,Fix_NP-12),
> longr(Fix_NSCAN,Fix_NP-16),longr(Fix_NSCAN,Fix_NP-20)/)
>              res at tmXBLabels    =
> (/longr(Fix_NSCAN,Fix_NP+20),longr(Fix_NSCAN,Fix_NP+16),longr(Fix_NSCAN,Fix_NP+12),longr(Fix_NSCAN,Fix_NP+08),longr(Fix_NSCAN,Fix_NP+04),longr(Fix_NSCAN,Fix_NP),longr(Fix_NSCAN,Fix_NP-04),
> longr(Fix_NSCAN,Fix_NP-08),longr(Fix_NSCAN,Fix_NP-12),
> longr(Fix_NSCAN,Fix_NP-16),longr(Fix_NSCAN,Fix_NP-20)/)
>
> Y axis is plotted and also shows 0.5, 1.5, 2.5 etc. How can I make it
> uniform say 1, 2, 3..... and so on.
>
> Reg X axis, I specified both res at tmXBValues and res at tmXBlabels (same) but
> it is not shown in the plot.
> Plot attatched
> thanks again
>
>
>
> Geeta.
>
>
> On Monday, 26 April, 2021, 9:13:56 pm IST, Adam Phillips <
> asphilli at ucar.edu> wrote:
>
>
> Hi Geeta,
> 1 - Very minor, but you do not need to set gsnSpreadColors = True, as that
> is the default.
> 2 - You are not setting trXMinF/trXMaxF/trYMinF/trYMaxF, which sets the
> minimum/maximum x-axis values, and  minimum/maximum y-axis values shown on
> the plot. You stated that the y-axis is elongated; if you mean it
> continues past a value of 18, try setting trYMaxF = 18.
> 3 - When you set tmXBMode = "Explicit", the range of x-axis values
> specified in the 2nd input to gsn_csm_contour (in your
> case, 1000*profile(:,Fix_NSCAN,153:193)) needs to overlap with your
> settings of tmXBValues. If those two settings do not overlap, the X-axis
> labels will not be visible. Verify that those two settings overlap.
>
> Hope that helps! If you have further questions please respond to the
> ncl-talk email list.
> Adam
>
> On Sun, Apr 25, 2021 at 9:03 AM Geeta Geeta via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
> Hi.
> I am unable to put labels on the Xaxis inspite to specifying tm at XBValues
> and res at XBLabels. and the Ya xis is elongated
>
> request someone to help me. I am attaching the figure so obtained.
> Following are the res in the code.
>
>
>                    res at tmXBMinorOn   =  False
> 150              res at tmYLMinorOn   =  False
> 151              res at tmYLMode      =  "Explicit"
> 152              res at tmYLValues    =  Ht_of_layers
> 153              res at tmYLLabels    =  Ht_of_layers
> 154 ;                                            defining X axis for all
> the plts together
> 155              Fix_NSCAN      =  1036
> 156              Fix_NP         =  173
> 157              xaxismin       =  Fix_NP+20
> 158              xaxismax       =  Fix_NP-20
> 159              xaxisinterval  =  1
> 160              int_for_plot   =  4
> 161
> 162     xaxis_fnl           =  ispan(xaxismin,xaxismax,xaxisinterval)
> 163                            print(xaxis_fnl)
> 164     xaxis_for_plotting  =  ispan(xaxismin,xaxismax,int_for_plot)
> 165                             printVarSummary(xaxis_for_plotting)
> 166                             print(xaxis_for_plotting)
> 167
> 168              res at tmXBMode      =  "Explicit"             ; will
> change from case to case
> 169 ;             res at tmXBValues   =  xaxis_for_plotting
> 170              res at tmXBValues    =
> (/longr(Fix_NSCAN,Fix_NP+20),longr(Fix_NSCAN,Fix_NP+16),longr(Fix_NSCAN,Fix_NP+12),longr(Fix_NSCAN,Fix_NP
> +08),longr(Fix_NSCAN,Fix_NP+04),longr(Fix_NSCAN,Fix_NP),longr(Fix_NSCAN,Fix_NP-04),
> longr(Fix_NSCAN,Fix_NP-08),longr(Fix_NSCAN,Fix_NP-12),
> longr(Fix_NSCAN,Fix_NP-16),longr(Fix_NSCAN,Fix_NP-20)/)
> 171              res at tmXBLabels    =
> (/longr(Fix_NSCAN,Fix_NP+20),longr(Fix_NSCAN,Fix_NP+16),longr(Fix_NSCAN,Fix_NP+12),longr(Fix_NSCAN,Fix_NP
> +08),longr(Fix_NSCAN,Fix_NP+04),longr(Fix_NSCAN,Fix_NP),longr(Fix_NSCAN,Fix_NP-04),
> longr(Fix_NSCAN,Fix_NP-08),longr(Fix_NSCAN,Fix_NP-12),
> longr(Fix_NSCAN,Fix_NP-16),longr(Fix_NSCAN,Fix_NP-20)/)
> 172
> 173
> 174                                   print(res at tmXBLabels)
> 175                                   print(res at tmXBValues)
> 176 ;             res at tmXBLabels    =  decimalPlaces(restmXBLabels,2,True)
> 177
>
>
>
> Geeta.
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210428/01751d3f/attachment.html>


More information about the ncl-talk mailing list