- General Bar Chart capability
Bar Charts
bar_1.ncl:
Example of a default bar chart. gsnXYBarChart must be set to True to turn a line plot into a bar chart. If you do not manually set gsnYRefLine, the plot template will check to see if trYMinF is set. If not, it will use the minimum value of the y-axis array.
bar_2.ncl:
Demonstrates coloring values above and below a reference line with a
particular color.
gsnAboveYRefLineColor = "red", and gsnBelowYRefLineColor = "blue", are the two resources required to shade the bars above and below the reference line.
bar_3.ncl:
Demonstrates changing the size of the bars.
By default, the thickness of each bar is delta-x. You can make the bars smaller than this by setting gsnXYBarChartBarWidth to a smaller number. In this instance, delta-x is 0.66 and we have changed the width to 0.1. Note that at this point you loose the colors.
bar_4.ncl:
Demonstrates changing the color the line box from around each bar.
This is useful when you have a lot of data points because the outline is
drawn after the color fill, and a black line and can obscure it.
xyLineColors = (/"red","blue"/), changes the outline color for the above and below color filled areas respectively.
bar_6.ncl:
Demonstrates how to make individual bars different colors within a bar
chart that has a reference line. The colors can be chosen separately
for the above and below bars (first plot), or sequentially regardless
of orientation (second plot).
gsnAboveYRefLineBarColors controls the colors of the bars above the reference line. This is an array. The colors will repeat. gsnBelowYRefLineBarColors controls the colors below the reference line.
gsnXYBarChartColors2 will assign a sequence of colors regardless of bar orientation.
bar_7.ncl:
A bar chart w/o a reference line, and individual colors. The second
frame adds a labelbar.
gsnXYBarChartColors controls the colors of the bars.
bar_8.ncl:
Demonstrates how to make individual bars different colors and
patterns within a bar chart that has a reference line. Colors are
distributed separately for bars above and below the reference line
(first plot), or regardless of orientation of the bars (second plot).
gsnAboveYRefLineBarPatterns controls the patterns of the bars above the reference line. This is an array. The patterns will repeat. gsnBelowYRefLineBarPatterns controls the patterns below the reference line.
gsnXYBarChartPatterns2 will apply the patterns regardless of the orientation of the bars.
There are several patterns to choose from.
bar_9.ncl:
This script creates a single bar chart showing 4 different timeseries
with four different colors. The labelbar is created by using gsn_labelbar_ndc.
polyg_10.ncl:
This example shows how to draw various polylines and polygons on a
several generic tickmark backgrounds to create a series of bar
charts. The gsn_add_polyline and
gsn_add_polygon functions are used
to create the polylines and polygons and gsn_panel is used to panel all the plots on
one frame.
