Credits | Overview | Plotting Styles | Commands | Terminals |
---|
The line segments and closed areas making up a mark definition may either be provided as [x,y] coordinates or as a pair of parametric functions x(t),y(t). One way of looking at the set mark command is that it acts like a simple plot command, plotting either data or a parametric function. In fact the set mark command uses the same input code layer as the plot command. It can even have an associated title to identify it. For more detail on how this works, see set mark.
This example defines four marks. Each is a background-filled shape that can be used to supplement the shapes available as default point types. Two of these marks are defined by arrays of coordinates. The other two are defined parametrically.
FILLSTROKE = 3 # indicates the mark has both lines and fill properties array Square = [{-1,-1}, { 1,-1}, { 1, 1}, {-1, 1}, {-1,-1}] array Triangle = [{0,1.2}, {1.04,-0.6}, {-1.04,-0.6}, {0,1.2}] set mark 1 Square using 2:3:(FILLSTROKE) fc bgnd title "square" set mark 2 Triangle using 2:3:(FILLSTROKE) fc bgnd title "triangle" set angle degrees set mark 3 [0:360:10] '+' using (sin($1)):(cos($1)):(FILLSTROKE) \ title "circle" fc bgnd set mark 4 [0:360:72] '+' using (sin($1)):(cos($1)):(FILLSTROKE) \ title "pentagon" fc bgnd unset angle
Just as you could use the existing default point types in a plot request "with linespoints pt N", you can now use the new custom shapes in a plot request "with linesmarks marktype N". Although not shown here, it is also possible to request marktype variable if the choice of shape is determined by an additional column of input data. The demo collection contains an expanded version of this example in extra_points.dem
set title "Custom point shapes defined as marks" plot for [M=1:4] -sin(x/M) with linesmarks marktype M