Re: horizontal offset when using gsnXYBarChartOutlineOnly

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Jan 23 2012 - 06:23:39 MST

Hi Brian,

This is the correct behavior, but it's not documented well. The bar chart and outlines are two different algorithms, and perhaps the resources are poorly named.

For a bar chart, the top center of each bar is the actual location of the data point, as your nice example illustrates. For the outlines, the idea is a straight line is drawn straight up to the actual data point, and not in the center of the width like the filled bar charts.

I'll try to clean up the documentation to clarify this better.

--Mary

On Jan 20, 2012, at 2:28 PM, Medeiros, Brian wrote:

> Hi NCLers,
>
> I just noticed that when I am drawing bar charts using gsnXYBarChart, there is a horizontal offset of half a bin-size if I turn on the outline-only option. I don't know if this is documented or not, but I didn't see it on the site, and it isn't the expected behavior.
>
> Example script below makes a plot of the bar chart with outline only turned on in black, then the regular bar chart in red, and then just the data points as blue markers. My output plot as a pdf from NCL 6.0 is also attached.
>
> .brian
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
>
> Y = genNormalDist(0, 10, False)
> X = Y@x
>
> wks = gsn_open_wks("pdf", "Test_Outlines")
>
> res = True
> res@vpHeightF = 0.25
> res@gsnDraw = False
> res@gsnFrame = False
>
> res@gsnXYBarChart = True
> res@gsnXYBarChartOutlineOnly = True
>
> plot = gsn_csm_xy(wks, X, Y, res)
>
>
> res@gsnXYBarChartOutlineOnly = False
> res@xyLineColor = "red"
> pltovr = gsn_csm_xy(wks, X, Y, res)
> overlay(plot, pltovr)
>
> res@gsnXYBarChart = False
> res@xyMarkLineMode = "Markers"
> res@xyMarkerColor = "blue"
> res@xyMarker = 1
>
> pltovr2 = gsn_csm_xy(wks, X, Y, res)
> overlay(plot, pltovr2)
>
> draw(plot)
> frame(wks)
> <Test_Outlines.pdf>_______________________________________________
> 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 Mon Jan 23 06:23:55 2012

This archive was generated by hypermail 2.1.8 : Mon Jan 23 2012 - 12:45:14 MST