Re: XY plot to superimpose different length datasets with different X grid points

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu Jul 14 2011 - 06:43:31 MDT

A minor variation of

Example 2 at http://www.ncl.ucar.edu/Applications/xy.shtml

    nv = 2 ; number of variables to be plotted
    nx1 = dimsizes(X1)
    nx2 = dimsizes(X2)
    N = max( (/nx1,nx2/) )
    x = new( (/nv,N/), typeof(X1) )
    y = new( (/nv,N/), typeof(Y1) )

    x(0,0:nx1-1) = X1
    x(1,0:nx2-1) = X2
    y(0,0:nx1-1) = Y1
    y(1,0:nx2-1) = Y2

    plot = gsn_csm_xy (wks,x,y,res)

On 7/14/11 4:45 AM, Helen Parish wrote:
> I want to plot 2 datasets on the same XY plot, using a single set of X
> and Y axes. The datasets have different lengths, but their X and Y
> values both fall within approximately the same ranges, so they can be
> plotted on the same X and Y axes. The X values and Y values of each
> dataset differ from each other.
>
> An example of this might be:
>
> X1 = 0.0, 1.3, 2.2, 3.7, 4.0
> Y1 = 3.1, 2.3, 4.8, 7,2, 3.4
>
> and
>
> X2 = 1.4, 2.6, 3.2
> Y2 = 1.5, 6.3, 5.7
>
> X1 and X2 both lie within approximately the same X-axis range, but
> their values do not fall on the same grid points, and the datasets
> have different lengths. However, both datasets should be able to be
> plotted on the same plot. I want to make a direct comparison between
> the datasets, so I do not want the plot to have two different X-axes
> in which, for example, the X2 range of 1.4 to 3.2 is expanded in
> length to correspond to the X1 range of 0.0 to 4.0. I presume this
> must be possible without having to go through an interpolation /
> extrapolation process to put the datasets onto exactly the same X grids.
>
> However, I have been unable to find an example where this simple
> superimposition of two different length datasets with different X
> grids is done, as all the examples appear to apply to datasets which
> use the same X axis points. Perhaps there is an example I have missed.
>
> Does anyone have any ideas how to do this ?.
>
> Thanks,
> Helen.
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jul 14 06:43:37 2011

This archive was generated by hypermail 2.1.8 : Mon Jul 18 2011 - 15:57:58 MDT