Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 591c941c2fdf0a32dc57bb5f10791cde > files > 626

gnuplot-doc-4.4.0-5.fc14.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--Converted with LaTeX2HTML 2008 (1.71)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Histograms</TITLE>
<META NAME="description" CONTENT="Histograms">
<META NAME="keywords" CONTENT="gnuplot">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META NAME="Generator" CONTENT="LaTeX2HTML v2008">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<LINK REL="STYLESHEET" HREF="gnuplot.css">

<LINK REL="next" HREF="node69.html">
<LINK REL="previous" HREF="node65.html">
<LINK REL="up" HREF="node55.html">
<LINK REL="next" HREF="node67.html">
</HEAD>

<BODY >
<!--Navigation Panel-->
<A NAME="tex2html1702"
  HREF="node67.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html1696"
  HREF="node55.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html1690"
  HREF="node65.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html1698"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html1700"
  HREF="node467.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html1703"
  HREF="node67.html">Newhistogram</A>
<B> Up:</B> <A NAME="tex2html1697"
  HREF="node55.html">Plotting styles</A>
<B> Previous:</B> <A NAME="tex2html1691"
  HREF="node65.html">Histeps</A>
 &nbsp; <B>  <A NAME="tex2html1699"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html1701"
  HREF="node467.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION030110000000000000000"></A>
<A NAME="commands_set_style_histogram"></A><A NAME="set_style_histogram"></A><A NAME="style_histograms"></A><A NAME="plotting_styles_histograms"></A><A NAME="histograms"></A><A NAME="1697"></A>
<BR>
Histograms
</H1>
The <B>histograms</B> style is only relevant to 2D plotting.  It produces a bar
chart from a sequence of parallel data columns. Each element of the <B>plot</B>
command must specify a single input data source (e.g. one column of the input
file), possibly with associated tic values or key titles.
Four styles of histogram layout are currently supported.

<P>
<BR>
<PRE>
     set style histogram clustered {gap &lt;gapsize&gt;}
     set style histogram errorbars {gap &lt;gapsize&gt;} {&lt;linewidth&gt;}
     set style histogram rowstacked
     set style histogram columnstacked
</PRE>
<BR>

<P>
The default style corresponds to <B>set style histogram clustered gap 2</B>.
In this style, each set of parallel data values is collected into a group of
boxes clustered at the x-axis coordinate corresponding to their sequential
position (row #) in the selected datafile columns.  Thus if 4#4n5#5 datacolumns are
selected, the first cluster is centered about x=1, and contains 4#4n5#5 boxes whose
heights are taken from the first entry in the corresponding 4#4n5#5 data columns.
This is followed by a gap and then a second cluster of boxes centered about x=2
corresponding to the second entry in the respective data columns, and so on.
The default gap width of 2 indicates that the empty space between clusters is
equivalent to the width of 2 boxes.  All boxes derived from any one column
are given the same fill color and/or pattern (see <B>set style fill (p.&nbsp;<A HREF="node264.html#set_style_fill"><IMG  ALIGN="BOTTOM" BORDER="1" ALT="[*]" SRC="crossref.png"></A>)<A NAME="1704"></A></B>).

<P>
Each cluster of boxes is derived from a single row of the input data file.
It is common in such input files that the first element of each row is a
label. Labels from this column may be placed along the x-axis underneath
the appropriate cluster of boxes with the <B>xticlabels</B> option to <B>using</B>.

<P>
The <B>errorbars</B> style is very similar to the <B>clustered</B> style, except that it
requires additional columns of input for each entry. The first column holds
the height (y value) of that box, exactly as for the <B>clustered</B> style.
<BR>
<PRE>
    2 columns:        y yerr          bar extends from y-yerr to y+err
    3 columns:        y ymin yman     bar extends from ymin to ymax
</PRE>
<BR>
The appearance of the error bars is controlled by the current value of
<B>set bars</B> and by the optional 4#4linewidth5#5 specification.

<P>
Two styles of stacked histogram are supported, chosen by the command
<B>set style histogram {rowstacked3#3columnstacked}</B>.  In these styles the data
values from the selected columns are collected into stacks of boxes.
Positive values stack upwards from y=0; negative values stack downwards.
Mixed positive and negative values will produce both an upward stack and a
downward stack.  The default stacking mode is <B>rowstacked</B>.

<P>
The <B>rowstacked</B> style places a box resting on the x-axis for each
data value in the first selected column; the first data value results in
a box a x=1, the second at x=2, and so on.  Boxes corresponding to the
second and subsequent data columns are layered on top of these, resulting
in a stack of boxes at x=1 representing the first data value from each
column, a stack of boxes at x=2 representing the second data value from
each column, and so on.  All boxes derived from any one column are given the
same fill color and/or pattern (see <B>set style fill (p.&nbsp;<A HREF="node264.html#set_style_fill"><IMG  ALIGN="BOTTOM" BORDER="1" ALT="[*]" SRC="crossref.png"></A>)<A NAME="1717"></A></B>).

<P>
The <B>columnstacked</B> style is similar, except that each stack of boxes is
built up from a single data column. Each data value from the first specified
column yields a box in the stack at x=1, each data value from the second
specified column yields a box in the stack at x=2, and so on.  In this style
the color of each box is taken from the row number, rather than the column
number, of the corresponding data field.

<P>
Box widths may be modified using the <B>set boxwidth</B> command.
Box fill styles may be set using the <B>set style fill</B> command.

<P>
Histograms always use the x1 axis, but may use either y1 or y2.
If a plot contains both histograms and other plot styles, the non-histogram
plot elements may use either the x1 or the x2 axis.

<P>
Examples:
Suppose that the input file contains data values in columns 2, 4, 6, ...
and error estimates in columns 3, 5, 7, ...  This example plots the values
in columns 2 and 4 as a histogram of clustered boxes (the default style).
Because we use iteration in the plot command, any number of data columns can
be handled in a single command. See <B>iteration (p.&nbsp;<A HREF="node109.html#iteration"><IMG  ALIGN="BOTTOM" BORDER="1" ALT="[*]" SRC="crossref.png"></A>)<A NAME="1722"></A></B>.

<P>
<BR>
<PRE>
     set boxwidth 0.9 relative
     set style data histograms
     set style histogram cluster
     set style fill solid 1.0 border lt -1
     plot for [COL=2:4:2] 'file.dat' using COL
</PRE>
<BR>

<P>
This will produce a plot with clusters of two boxes (vertical bars) centered
at each integral value on the x axis.  If the first column of the input file
contains labels, they may be placed along the x-axis using the variant command

<P>
<BR>
<PRE>
     plot for [COL=2:4:2] 'file.dat' using COL:xticlabels(1)
</PRE>
<BR>

<P>
If the file contains both magnitude and range information for each value,
then error bars can be added to the plot.  The following commands will add
error bars extending from (y-4#4error5#5) to (y+4#4error5#5), capped by horizontal bar
ends drawn the same width as the box itself. The error bars and bar ends are
drawn with linewidth 2, using the border linetype from the current fill style.

<P>
<BR>
<PRE>
     set bars fullwidth
     set style fill solid 1 border lt -1
     set style histogram errorbars gap 2 lw 2
     plot for [COL=2:4:2] 'file.dat' using COL:COL+1
</PRE>
<BR>

<P>
To plot the same data as a rowstacked histogram.  Just to be different, this
example lists the separate columns explicitly rather than using iteration.

<P>
<BR>
<PRE>
     set style histogram rowstacked
     plot 'file.dat' using 2, '' using 4:xtic(1)
</PRE>
<BR>

<P>
This will produce a plot in which each vertical bar corresponds to one row of
data.  Each vertical bar contains a stack of two segments, corresponding in
height to the values found in columns 2 and 4 of the datafile.

<P>
Finally, the commands

<P>
<BR>
<PRE>
     set style histogram columnstacked
     plot 'file.dat' using 2, '' using 4
</PRE>
<BR>

<P>
will produce two vertical stacks, one for each column of data.  The stack at
x=1 will contain a box for each entry in column 2 of the datafile.  The stack
at x=2 will contain a box for each parallel entry in column 4 of the datafile.
Because this interchanges gnuplot's usual interpretation of input rows and
columns, the specification of key titles and x-axis tic labels must also be
modified accordingly. See the comments given below.

<P>
<BR>
<PRE>
     set style histogram columnstacked
     plot '' u 5:key(1)            # uses first column to generate key titles
     plot '' u 5 title columnhead  # uses first row to generate xtic labels
</PRE>
<BR>

<P>
Note that the two examples just given present exactly the same data values,
but in different formats.
<BR><HR>
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>

<UL>
<LI><A NAME="tex2html1704"
  HREF="node67.html">Newhistogram</A>
<LI><A NAME="tex2html1705"
  HREF="node68.html">Automated iteration over multiple columns</A>
</UL>
<!--End of Table of Child-Links-->
<HR>
<!--Navigation Panel-->
<A NAME="tex2html1702"
  HREF="node67.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html1696"
  HREF="node55.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html1690"
  HREF="node65.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html1698"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html1700"
  HREF="node467.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html1703"
  HREF="node67.html">Newhistogram</A>
<B> Up:</B> <A NAME="tex2html1697"
  HREF="node55.html">Plotting styles</A>
<B> Previous:</B> <A NAME="tex2html1691"
  HREF="node65.html">Histeps</A>
 &nbsp; <B>  <A NAME="tex2html1699"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html1701"
  HREF="node467.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>

2010-08-17
</ADDRESS>
</BODY>
</HTML>