[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2.21.59.8 set style rectangle
Rectangles defined with the `set object rectangle` command can have individual styles. However, if a rectangle is not assigned a private style then it inherits a default that is taken from the `set style rectangle` command.
Syntax:
set style rectangle {front|back} {fillcolor <colorspec>} {fs <fillstyle>} {lw|linewidth <lw>} |
See colorspec and `fillstyle`. `fillcolor` may be abbreviated as `fc`.
Examples:
set style rectangle back fc rgb "white" fs solid 1.0 border -1 set style rectangle fc linsestyle 3 fs pattern 2 noborder |
The default values correspond to solid fill with the background color and a black border.
— BOXERRORBARS —
The `boxerrorbars` style is only relevant to 2-d data plotting. It is a combination of the `boxes` and `yerrorbars` styles. The boxwidth will come from the fourth column if the y errors are in the form of "ydelta" and the boxwidth was not previously set equal to -2.0 (`set boxwidth -2.0`) or from the fifth column if the y errors are in the form of "ylow yhigh". The special case `boxwidth = -2.0` is for four-column data with y errors in the form "ylow yhigh". In this case the boxwidth will be calculated so that each box touches the adjacent boxes. The width will also be calculated in cases where three-column data are used.
The box height is determined from the y error in the same way as it is for the `yerrorbars` style—either from y-ydelta to y+ydelta or from ylow to yhigh, depending on how many data columns are provided. See also errorbar demo.
— BOXES —
The `boxes` style is only relevant to 2-d plotting. It draws a box centered about the given x coordinate from the x axis (not the graph border) to the given y coordinate. The width of the box is obtained in one of three ways. If it is a data plot and the data file has a third column, this will be used to set the width of the box. If not, if a width has been set using the boxwidth command, this will be used. If neither of these is available, the width of each box will be calculated automatically so that it touches the adjacent boxes.
The interior of the boxes is drawn according to the current fillstyle. See `set style fill` for details. Alternatively a new fillstyle may be specified in the plot command.
For fillstyle `empty` the box is filled with the background color.
For fillstyle `solid` the box is filled with a solid rectangle of the current drawing color. There is an optional parameter <density> that controls the fill density; it runs from 0 (background color) to 1 (current drawing color).
For fillstyle `pattern` the box is filled in the current drawing color with a pattern, if supported by the terminal driver.
Examples:
To plot a data file with solid filled boxes with a small vertical space separating them (bargraph):
set boxwidth 0.9 relative set style fill solid 1.0 plot 'file.dat' with boxes |
To plot a sine and a cosine curve in pattern-filled boxes style:
set style fill pattern plot sin(x) with boxes, cos(x) with boxes |
The sin plot will use pattern 0; the cos plot will use pattern 1. Any additional plots would cycle through the patterns supported by the terminal driver.
To specify explicit fillstyles for each dataset:
plot 'file1' with boxes fs solid 0.25, \ 'file2' with boxes fs solid 0.50, \ 'file3' with boxes fs solid 0.75, \ 'file4' with boxes fill pattern 1, \ 'file5' with boxes fill empty |
Currently only the following terminal drivers support fillstyles other than `empty`: x11, windows, pm, wxt, postscript, fig, pbm, png, gif, hpdj, hppj, hpljii, hp500c, jpeg, nec_cp6, epson_180dpi, epson_60dpi, epson_lx800, okidata, starc and tandy_60dpi. The BeOS driver (`be`) is untested.
— BOXXYERRORBARS —
The `boxxyerrorbars` style is only relevant to 2-d data plotting. It is a combination of the `boxes` and `xyerrorbars` styles.
The box width and height are determined from the x and y errors in the same way as they are for the `xyerrorbars` style—either from xlow to xhigh and from ylow to yhigh, or from x-xdelta to x+xdelta and from y-ydelta to y+ydelta , depending on how many data columns are provided.
If filled-box support is present, then the interior of the boxes is drawn according to the current fillstyle. See `set style fill` and `boxes` for details. Alternatively a new fillstyle may be specified in the plot command.
— CANDLESTICKS —
The `candlesticks` style can be used for 2-d data plotting of financial data or for generating box-and-whisker plots of statistical data. Five columns of data are required; in order, these should be the x coordinate (most likely a date) and the opening, low, high, and closing prices. The symbol is a rectangular box, centered horizontally at the x coordinate and limited vertically by the opening and closing prices. A vertical line segment at the x coordinate extends up from the top of the rectangle to the high price and another down to the low. The vertical line will be unchanged if the low and high prices are interchanged.
The width of the rectangle can be controlled by the boxwidth command. For backwards compatibility with earlier gnuplot versions, when the boxwidth parameter has not been set then the width of the candlestick rectangle is controlled by `set bars <width>`.
By default the vertical line segments have no crossbars at the top and bottom. If you want crossbars, which are typically used for box-and-whisker plots, then add the keyword `whiskerbars` to the plot command. By default these whiskerbars extend the full horizontal width of the candlestick, but you can modify this by specifying a fraction of the full width.
By default the rectangle is empty if (open < close), and filled with three vertical bars if (close < open). If filled-boxes support is present, then the rectangle is colored according to `set style fill <fillstyle>`. See bars and `financebars`. See also finance demos .
Note: To place additional symbols, such as the median value, on a box-and-whisker plot requires additional plot commands as in this example:
# Data columns: X Min 1stQuartile Median 3rdQuartile Max set bars 4.0 set style fill empty plot 'stat.dat' using 1:3:2:6:5 with candlesticks title 'Quartiles', \ '' using 1:4:4:4:4 with candlesticks lt -1 notitle |
# Plot with crossbars on the whiskers, crossbars are 50% of full width plot 'stat.dat' using 1:3:2:6:5 with candlesticks whiskerbars 0.5 |
See boxwidth, bars and `set style fill`. |
— DOTS —
The `dots` style plots a tiny dot at each point; this is useful for scatter plots with many points. For some terminals (post, pdf) the size of the dot can be controlled by changing the linewidth.
— FILLEDCURVES —
The `filledcurves` style is only relevant to 2-d plotting. Three variants are possible. The first two variants require either a function or two columns of input data, and may be further modified by the options listed below. The first variant, `closed`, treats the curve itself as a closed polygon. This is the default if there are two columns of input data.
The second variant is to fill the area between the curve and a given axis, a horizontal or vertical line, or a point.
The third variant requires three columns of input data: the x coordinate and two y coordinates corresponding to two curves sampled at the same set of x coordinates; the area between the two curves is filled. This is the default if there are three or more columns of input data.
Syntax:
set style [data | function] filledcurves [option] plot ... with filledcurves [option] |
where the option can be
[closed | {above | below} {x1 | x2 | y1 | y2}[=<a>] | xy=<x>,<y>] |
The first two plot variants can be further modified by the options
filledcurves closed ... just filled closed curve, filledcurves x1 ... x1 axis, filledcurves x2 ... x2 axis, etc for y1 and y2 axes, filledcurves y1=0 ... line y=0 (at y1 axis) ie parallel to x1 axis, filledcurves y2=42 ... line y=42 (at y2 axis) ie parallel to x2, etc, filledcurves xy=10,20 ... point 10,20 of x1,y1 axes (arc-like shape). |
Example of filling the area between two input curves. fill between curves demo.
plot 'data' using 1:2:3 with filledcurves |
The `above` and `below` options apply both to commands of the form
... filledcurves above {x1|x2|y1|y2}=<val> |
and to commands of the form
... using 1:2:3 with filledcurves below |
In either case the option limits the filled area to one side of the bounding line or curve.
Note: Not all terminal types support this plotting mode.
Zoom of a filled curve drawn from a datafile may produce empty or incorrect area because gnuplot is clipping points and lines, and not areas.
If the values of <a>, <x>, <y> are out of the drawing boundary, then they are moved to the graph boundary. Then the actually filled area in the case of option xy=<x>,<y> will depend on xrange and yrange.
— FINANCEBARS —
The `financebars` style is only relevant for 2-d data plotting of financial data. Five columns of data are required; in order, these should be the x coordinate (most likely a date) and the opening, low, high, and closing prices. The symbol is a vertical line segment, located horizontally at the x coordinate and limited vertically by the high and low prices. A horizontal tic on the left marks the opening price and one on the right marks the closing price. The length of these tics may be changed by bars. The symbol will be unchanged if the high and low prices are interchanged. See bars and `candlesticks`, and also the finance demo.
— FSTEPS —
The `fsteps` style is only relevant to 2-d plotting. It connects consecutive points with two line segments: the first from (x1,y1) to (x1,y2) and the second from (x1,y2) to (x2,y2). See also steps demo.
— HISTEPS —
The `histeps` style is only relevant to 2-d plotting. It is intended for plotting histograms. Y-values are assumed to be centered at the x-values; the point at x1 is represented as a horizontal line from ((x0+x1)/2,y1) to ((x1+x2)/2,y1). The lines representing the end points are extended so that the step is centered on at x. Adjacent points are connected by a vertical line at their average x, that is, from ((x1+x2)/2,y1) to ((x1+x2)/2,y2).
If autoscale is in effect, it selects the xrange from the data rather than the steps, so the end points will appear only half as wide as the others. See also steps demo.
`histeps` is only a plotting style; `gnuplot` does not have the ability to create bins and determine their population from some data set.
— HISTOGRAMS —
The `histograms` style is only relevant to 2-d plotting. It produces a bar chart from a sequence of data columns in parallel. Each element of the `plot` 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.
set style histogram clustered {gap <gapsize>} set style histogram errorbars {gap <gapsize>} {<linewidth>} set style histogram rowstacked set style histogram columnstacked |
The default style corresponds to `set style histogram clustered gap 2`. 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 <n> datacolumns are selected, the first cluster is centered about x=1, and contains <n> boxes whose heights are taken from the first entry in the corresponding <n> 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 `set style fill`).
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 `xticlabels` option to using.
The errorbars style is very similar to the `clustered` style, except that it requires two columns of input for each entry. The first column is treated as the height (y-value) of that box, exactly as for the `clustered` style. The second column is treated as an error magnitude, and used to generate a vertical error bar at the top of the box. The appearance of the error bar is controlled by the current value of bars and by the optional <linewidth> specification.
Two styles of stacked histogram are supported, chosen by the command `set style histogram {rowstacked|columnstacked}`. 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 `rowstacked`.
The `rowstacked` 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 `set style fill`).
The `columnstacked` 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.
Box widths may be modified using the boxwidth command. Box fill styles may be set using the `set style fill` command.
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.
Examples:
To plot a data file containing multiple columns of data as a histogram of clustered boxes (the default style):
set boxwidth 0.9 relative set style data histograms set style fill solid 1.0 border -1 plot 'file.dat' using 2, '' using 4, '' using 6 |
This will produce a plot with clusters of three 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
plot 'file.dat' using 2, '' using 4, '' using 6:xticlabels(1) |
If the file contains both a magnitude and an error estimate for each value, then error bars can be added to the plot. The following commands will add error bars extending from (y-<error>) to (y+<error>), 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.
set bars fullwidth set style fill solid border -1 set style histogram errorbars gap 2 lw 2 plot 'file.dat' using 2:3, '' using 4:5, '' using 6:7:xticlabels(1) |
To plot the same data as a rowstacked histogram:
set style histogram rows plot 'file.dat' using 2, '' using 4, '' using 6:xtic(1) |
This will produce a plot in which each vertical bar contains a stack of three segments, corresponding in height to the values found in columns 2, 4 and 6 of the datafile.
Finally, the commands
set style histogram columnstacked plot 'file.dat' using 2, '' using 4, '' using 6 |
will produce three vertical stacks. 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, and the stack at x=3 a box for each entry of column 6. 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.
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 |
— NEWHISTOGRAM —
More than one set of histograms can appear in a single plot. In this case you can force a gap between them, and a separate label for each set, by using the plot command `newhistogram {"<title>"} {<linetype>} {at <x-coord>}`. For example
set style histogram cluster plot newhistogram "Set A", 'a' using 1, '' using 2, '' using 3, \ newhistogram "Set B", 'b' using 1, '' using 2, '' using 3 |
The labels "Set A" and "Set B" will appear beneath the respective sets of histograms, under the overall x axis label.
The newhistogram command can also be used to force histogram coloring to begin with a specific color (linetype). By default colors will continue to increment successively even across histogram boundaries. Here is an example using the same coloring for multiple histograms
plot newhistogram "Set A" lt 4, 'a' using 1, '' using 2, '' using 3, \ newhistogram "Set B" lt 4, 'b' using 1, '' using 2, '' using 3 |
The `at <x-coord>` option only applies to column-stacked histograms.
— IMAGE —
The `image` style is intendend for plotting 2D images. It may be used for both `plot` and `splot` in the form of 3D data (x,y,value) or projected 4D data (x,y,z,value), respectively. It is assumed that in the viewing plane the image data forms an equidistant sampling grid in the viewing plane along two, not necessarily orthogonal, directions. In other words, groups of four adjacent points are assumed to form the same size parallelogram. The variable `value` in the tuples represent a palette color (gray value) for indexing in the current palette.
The `image` style will attempt to create a properly positioned and scaled data matrix to match the plot borders for those terminals supporting palettes and images. Such output is efficient and draws quickly. However, when a terminal driver does not support palettes and images, or when image support is not implemented, the `image` style reverts to drawing filled rectangular boxes for pixels, which is not as efficient. General parallelogram-shaped images currently always have filled parallelograms for pixels.
The coordinate of each data point of an image will lie at the center of a pixel. That is, an M x N set of data will form an image with M x N pixels. This is slightly different than pm3d elements where an M x N set of data will form a surface of (M-1) x (N-1) elements. The scan directions for the image data grid can be any of eight possible combinations.
Here are some specific comments about particular terminal drivers:
x11 and wxt - Pixels are either repeated or decimated to fit the display
resolution; no other processing (filtering) is done. Thus, aliasing may occur when decimating images having high spatial frequency content. |
postscript (pslatex, epslatex, pstex) - Image is copied in its original
resolution, and sample interpolation is turned off. |
See also `rgbimage`.
— IMPULSES —
The `impulses` style displays a vertical line from the x axis (not the graph border), or from the grid base for `splot`, to each point.
— LABELS —
The `labels` style is available only if gnuplot is built with configuration option –enable-datastrings. For a 2-D plot with labels you must specify 3 input data columns; the text string found in the third column is printed at the X and Y coordinates generated by the first two column specifiers. The font, color, rotation angle and other properties of the printed text may be specified as additional command options (see label). The example below will generate a 2-D plot with text labels taken from column 4 of the input file (`tc lt 2` is shorthand for `textcolor linetype 2`, which is green).
plot 'datafile' using 1:(0.5 * $2):4 with labels font "arial,11" tc lt 2 |
The `labels` style can also be used in 3-D plots. In this case four input column specifiers are required, corresponding to X Y Z and text.
splot 'datafile' using 1:2:3:4 with labels |
See also `datastrings`, `set style data`.
— LINES —
The `lines` style connects adjacent points with straight line segments. See also `linetype`, `linewidth`, and `linestyle`.
— LINESPOINTS —
The `linespoints` style does both `lines` and `points`, that is, it draws a small symbol at each point and then connects adjacent points with straight line segments. The command pointsize may be used to change the size of the points. See pointsize for its usage.
`linespoints` may be abbreviated `lp`.
— POINTS —
The `points` style displays a small symbol at each point. The command pointsize may be used to change the size of the points. See pointsize for its usage.
— STEPS —
The `steps` style is only relevant to 2-d plotting. It connects consecutive points with two line segments: the first from (x1,y1) to (x2,y1) and the second from (x2,y1) to (x2,y2). See also steps demo.
— RGBIMAGE —
The `rgbimage` style is intended for plotting 2D images and is similar in concept to `image`. See `image` for details. The difference is that 5D data (x,y,r,g,b) for `plot` and 6D data (x,y,z,r,g,b) for `splot` describe the coordinates and color components of an image.
See also `image`.
— VECTORS —
The 2D `vectors` style draws a vector from (x,y) to (x+xdelta,y+ydelta). Thus it requires four columns of data. It also draws a small arrowhead at the end of the vector. The 3D `vectors` style is similar, but requires six columns of data. splot with vectors is supported only for `set mapping cartesian`. The keywords "with vectors" may be followed by arrow style specifications. See `arrowstyle` for more details.
Example:
plot 'file.dat' using 1:2:3:4 with vectors head filled lt 2 splot 'file.dat' using 1:2:3:(1):(1):(1) with vectors filled head lw 2 |
`set clip one` and `set clip two` affect vectors drawn in 2D. Please see clip and `arrowstyle`.
— XERRORBARS —
The `xerrorbars` style is only relevant to 2-d data plots. `xerrorbars` is like `dots`, except that a horizontal error bar is also drawn. At each point (x,y), a line is drawn from (xlow,y) to (xhigh,y) or from (x-xdelta,y) to (x+xdelta,y), depending on how many data columns are provided. A tic mark is placed at the ends of the error bar (unless bars is used—see bars for details).
— XYERRORBARS —
The `xyerrorbars` style is only relevant to 2-d data plots. `xyerrorbars` is like `dots`, except that horizontal and vertical error bars are also drawn. At each point (x,y), lines are drawn from (x,y-ydelta) to (x,y+ydelta) and from (x-xdelta,y) to (x+xdelta,y) or from (x,ylow) to (x,yhigh) and from (xlow,y) to (xhigh,y), depending upon the number of data columns provided. A tic mark is placed at the ends of the error bar (unless bars is used—see bars for details).
If data are provided in an unsupported mixed form, the using filter on the `plot` command should be used to set up the appropriate form. For example, if the data are of the form (x,y,xdelta,ylow,yhigh), then you can use
plot 'data' using 1:2:($1-$3):($1+$3):4:5 with xyerrorbars |
— YERRORBARS —
The `yerrorbars` (or errorbars) style is only relevant to 2-d data plots. `yerrorbars` is like `points`, except that a vertical error bar is also drawn. At each point (x,y), a line is drawn from (x,y-ydelta) to (x,y+ydelta) or from (x,ylow) to (x,yhigh), depending on how many data columns are provided. A tic mark is placed at the ends of the error bar (unless bars is used—see bars for details). See also errorbar demo.
— XERRORLINES —
The `xerrorlines` style is only relevant to 2-d data plots. `xerrorlines` is like `linespoints`, except that a horizontal error line is also drawn. At each point (x,y), a line is drawn from (xlow,y) to (xhigh,y) or from (x-xdelta,y) to (x+xdelta,y), depending on how many data columns are provided. A tic mark is placed at the ends of the error bar (unless bars is used—see bars for details).
— XYERRORLINES —
The `xyerrorlines` style is only relevant to 2-d data plots. `xyerrorlines` is like `linespoints`, except that horizontal and vertical error bars are also drawn. At each point (x,y), lines are drawn from (x,y-ydelta) to (x,y+ydelta) and from (x-xdelta,y) to (x+xdelta,y) or from (x,ylow) to (x,yhigh) and from (xlow,y) to (xhigh,y), depending upon the number of data columns provided. A tic mark is placed at the ends of the error bar (unless bars is used—see bars for details).
If data are provided in an unsupported mixed form, the using filter on the `plot` command should be used to set up the appropriate form. For example, if the data are of the form (x,y,xdelta,ylow,yhigh), then you can use
plot 'data' using 1:2:($1-$3):($1+$3):4:5 with xyerrorlines |
— YERRORLINES —
The `yerrorlines` (or errorlines) style is only relevant to 2-d data plots. `yerrorlines` is like `linespoints`, except that a vertical error line is also drawn. At each point (x,y), a line is drawn from (x,y-ydelta) to (x,y+ydelta) or from (x,ylow) to (x,yhigh), depending on how many data columns are provided. A tic mark is placed at the ends of the error bar (unless bars is used—see bars for details). See also errorbar demo.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |