Lines Styles and Markers

by Martin D. Maas, Ph.D

Set the basic series attributes in order to choose between solid, dashed or dotted line plots, bar plots, or scatter plots

Dashed/dotted line plots and more

To begin styling our plot, we can begin with setting the following Series attributes:

Series attributesType
seriestype:path, :sticks, :scatter, :bar
linestyle:solid, :dash, :dot, :dashdot, :dashdotdot
seriescolorColor Type

which will allow us to style the line.

For example, the code to produce a simple dashed line is

using Plots
x = 0:0.05:1;
y = sin.(2π*x);

plot(   x, y, 

while for a dotted line, we simply replace the linestyle=:dash with


This is how some different combinations of seriestype and linestyle look like.

Julia Plot Linestlye

Note that changing the seriestype of a column is equivalent to using commands such as scatter(x,y), bar(x,y), etc.

Custom Marker Shapes

Optionally, we can also add different kinds of marker shapes on top of the selected lines, with the following attributes:

Series attributesType
marker:d, :hex,
markerstrokecolorColor Type

Let’s see a full example

using Plots
x = 0:0.05:1;
y = sin.(2π*x);

plot(   x, y, 
        lw = 3,
        seriescolor = :green,
        marker = :circle,
        markersize = 8,
        markercolor = :green,
        markerstrokecolor = :green,

Julia Plot Linestlye

More succintly with line and marker tuples

When composing many different options to customize a plot, setting so many attributes one by one can become annoying.

More succintly, we can also use the equivalent syntax:

plot(   x, y, 

Note that, remarkably, the line or marker tuples can contain their elements in different orders, so line=(:path,:dash,:green,2) or line=(2,:green,:dash,:path) will work as well.

Picking Colors

As for picking different colors for our lines or markers, the Color Type can stand for any symbol of the following list, like :darkblue, :firebrick, etc.