Markers near edge of plot

From: Carl J. Schreck, III <carl_at_nyahnyahspammersnyahnyah>
Date: Fri, 13 Jun 2008 11:24:41 -0400

I have a question regarding Markers near the edge of an xy-plot. I am
wondering if there is a way to do two things:

1) Clip markers that are near the edge of a plot so nothing appears
outside the plot

2) For markers that are just outside the plot, I would like to show the
part of the marker that falls inside.

I have attached a modified version of the gsun01n.ncl example to show
what I mean. The first frame is essentially the original example. I
would like ncl to clip the part of the top asterisk that is outside the
plot.

On the second frame, I've changed the maximum axis to 4.85. I'd like to
still show the part of the top asterisk (y=5) that would lie inside the
plot if it were drawn, but also clip the two next to it that go outside
the plot.

Let me know if you have any suggestions. The results are the same if I
manually plot the markers with gsn_add_text.

Thanks for your help.

        Cheers,
        Carl

load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"

begin
  
  x = (/10.,20.,30.,40.,50.,60.,70.,80.,90./)
  y2 = (/(/0., 0.7, 1., 0.7, 0., -0.7, -1., -0.7, 0./),\
        (/2., 2.7, 3., 2.7, 2., 1.3, 1., 1.3, 2./),\
        (/4., 4.7, 5., 4.7, 4., 3.3, 3., 3.3, 4./)/)

  wks = gsn_open_wks("x11","marker-demo")

  resources = True ; Indicate you want to
                                               ; set some resources.

  resources_at_xyLineColors = (/2,3,4/) ; Define line colors.
  resources_at_xyLineThicknesses = (/1.,2.,5./) ; Define line thicknesses
                                               ; (1.0 is the default).

  resources_at_tiMainString = "X-Y plot" ; Title for the XY plot
  resources_at_tiXAxisString = "X Axis" ; Label for the X axis
  resources_at_tiYAxisString = "Y Axis" ; Label for the Y axis
  resources_at_tiMainFont = "Helvetica" ; Font for title
  resources_at_tiXAxisFont = "Helvetica" ; Font for X axis label
  resources_at_tiYAxisFont = "Helvetica" ; Font for Y axis label

  resources_at_xyMarkLineModes = (/"Lines","Markers","MarkLines"/)
  resources_at_xyMarkers = (/0,1,3/) ; (none, dot, asterisk)
  resources_at_xyMarkerColor = 3 ; Marker color
  resources_at_xyMarkerSizeF = 0.05 ; Marker size (default
                                          ; is 0.01)
  resources_at_xyMarkerThicknessF = 5

  plot = gsn_xy(wks,x,y2,resources) ; Draw an XY plot.

  ; Here I'm going to set my window size to show the problem
  resources_at_trYMaxF = 4.85

  plot = gsn_xy(wks,x,y2,resources) ; Draw an XY plot.

end

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 13 2008 - 09:24:41 MDT

This archive was generated by hypermail 2.2.0 : Tue Jun 17 2008 - 10:30:09 MDT