Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.5.1 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2024.1.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Graphics > 2d_plot > LineSpec


to quickly customize the lines appearance in a plot


The LineSpec is an optional argument that can be used inside a plot command to customize each new line aspect. It has to be given as a concatenated string containing information about color, line style or markers. It is very useful to quickly specify such basic line properties.

To specify a red longdash-dot with diamond marker, the string can be 'r-.diam'. As you can see, a full complete spelling of each property value is not required but the string, which is a concatenation (in any order) of these three types of properties, must remain unambiguous. Furthermore, the string specification is not case sensitive.

Here is a complete list of the LineSpec types you can specify (using plot).


a string defining the line style. This property is linked to the object's line_style property (see polyline properties).

Specifier Line Style
- Solid line (default)
-- Dashed line
: Dotted line
-. Dash-dotted line

a string defining the line color. This property is linked to the object's foreground property (see polyline properties).

Specifier Color
r Red
g Green
b Blue
c Cyan
m Magenta
y Yellow
k Black
w White

A default color table is used to color plotted curves if you do not specify a color (neither with LineSpec nor with GlobalProperty). When drawing multiple lines, the plot command automatically cycles through this table. Here are the used colors:

0. 0. 1.
0. 0.5 0.
1. 0. 0.
0. 0.75 0.75
0.75 0. 0.75
0.75 0.75 0.
0.25 0.25 0.25
Marker type:

A string defining the marker type. Note that if you specify a marker without a line style, only the marker is drawn. This property is linked to the object's mark_style and mark_mode properties (see polyline properties).

Specifier Marker Type
+ Plus sign
o Circle
* Asterisk
. Point
x Cross
'square' or 's' Square
'diamond' or 'd' Diamond
^ Upward-pointing triangle
v Downward-pointing triangle
> Right-pointing triangle
< Left-pointing triangle
'pentagram' or 'p' Five-pointed star (pentagram)
No marker (default)


x=1:0.1:10; // Init.
plot(x,sin(x),'r-.>') // plots a dash-dotted line with a right-pointing triangle centered on each points.
// If you specify a marker without a line style, only the marker is drawn
x = 1:0.5:10; // Init.
// The order of information about color, line style or markers does not matter
// BUT the information must be unambiguous 
subplot(313);plot(x,sin(x),'b-.');// The point belongs to information about line style (not marker!)
//multiple plots with different LineSpecs

See Also

  • color — returns the color id of a color
  • GlobalProperty — to customize the objects appearance (curves, surfaces...) in a plot or surf command
  • plot — 2D plot
  • clf — Clear or reset or reset a figure or a frame uicontrol.
Report an issue
<< 2d_plot 2d_plot Matplot >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 02 13:46:51 CEST 2014