Next: panelplot() Up: Graphics Macros Help File Previous: news   Contents

panelhist()

Usage:
panelhist(x, edges or nbars, pos:k or pos:vector(r,c), hstrips:h,\
  vstrips:v [,label:lab] [,hist keyword phrases]\
  [,graphics keyword phrases]), REAL vectors x and edges, positive
  integers k, r, c, h and v, CHARACTER scalar lab



Keywords: panel graphs, bar graphs
panelhist(x, nbars, pos:position, hstrips:h, vstrips:v) draws a
histogram with nbars equal width bars in a pane of an h by v panel
graph, an rectangular array of small graphs, where h and v are positive
integers.  See topic 'panel_graphs'.

When position is of the form vector(r, c) where 1 <= r <= h and 1 <= c
<= v are integers, the histogram is drawn in row r and column c.  When
position = n, with positive integer n <= h*v, the histogram is drawn in
pane n, counting across rows starting in row 1.

panelhist(x, vector(anchor,w), pos:position, hstrips:h, vstrips:v
[,label:lab]) does the same, except the bars all have width w, with the
edges all of the form anchor + j*w, where j is an integer.  For
example, vector(-.5, 1) specifies unit width bars centered on integers.

panelhist(x, edges, pos:position, hstrips:h, vstrips:v [,label:lab])
does the same, except the edges of the bars are taken from the elements
of REAL vector edges.  They must be in strictly increasing order.

With all usages, you can include keyword phrases 'freq:T', 'relfreq:T',
'leftendin:T' and 'outsideok:T' as used with macro hist().  See topic
hist()

With all usages you can include 'label:lab', where lab is a CHARACTER
scalar.  After the histogram is drawn you then use the mouse to specify
a place where lab should be added to the graph.

You can use graphics keywords 'window', 'show', 'title', 'xlab', 'ylab',
'add', 'yaxis', 'xmin', 'xmax', ymin', and 'ymax' plus keywords having
to do with files.  See topic 'graph_keys'.  With show:T, label:lab is
ignored.

You should use 'add:T' when drawing in a pane in an existing panel
graph.

You cannot use graphics keywords 'lines', 'linetype', 'impulse',
'thickness', 'xaxis', 'logx', and 'logy' and keywords having to do with
tick marks.

Example:
  Cmd> irisdata <- matread("macanova.dat","irisdata") #Fisher data

  Cmd> # column 1 is variety number; columsn 2 - 5 are data

  Cmd> colnames <- vector("SepLen","SepWid","PetLen","PetWid")

  Cmd> plotmatrix(irisdata[,-1],name:"Iris Data",diaglabs:F, show:F,\
    symbols:vector("\21","\22","\23")[irisdata[,1]], labels:colnames)

  Cmd> for(i,1,4) { # add 16 bar histograms to diagonal
    panelhist(irisdata[,i+1],16,pos:rep(i,2),hstrips:4,vstrips:4,\
    add:T,show:i==4) }

This uses plotmatrix() to create a scatter plot matrix of the Fisher
iris data, and then adds histograms of each variable to the diagonal,
displaying the plot only when the last histogram has been drawn.

See also plotmatrix(), panelplot(), hist(), 'graph_keys'.


Gary Oehlert 2003-01-15