In Plots, input data is passed positionally (for example, the
plot(y)), and attributes are passed as keywords (for example,
plot(y, color = :blue)).
Most of the information on this page is available from your Julia session with the function
plotattr(:Series) to print a list of all series attributes, or
plotattr("ms") to print the aliases and descriptions of
Keywords can take a range of values through the alias mechanic. For example,
plot(y, color = :blue) is really interpreted as
plot(y, seriescolor = :blue). Each attribute has a number of aliases (see the charts below), which are available to avoid the pain of constantly looking up plotting API documentation because you forgot the argument name.
seriescolor all mean the same thing, and in fact those are eventually converted into the more precise attributes
fillcolor (which you can then override if desired).
Use aliases for one-off analysis and visualization, but use the true keyword name for long-lived library code to avoid confusion.
As of this writing, aliases do not work inside recipes!!
Some arguments encompass smart shorthands for setting many related arguments at the same time. Plots uses type checking and multiple dispatch to smartly "figure out" which values apply to which argument. Pass in a tuple of values. Single values will be first wrapped in a tuple before processing.
axis (and xaxis/yaxis/zaxis)
Passing a tuple of settings to the
xaxis argument will allow the quick definition of
xtickfont. The following are equivalent:
plot(y, xaxis = ("my label", (0,10), 0:0.5:10, :log, :flip, font(20, "Courier"))) plot(y, xlabel = "my label", xlims = (0,10), xticks = 0:0.5:10, xscale = :log, xflip = true, xtickfont = font(20, "Courier"))
zaxis work similarly, and
axis will apply to all.
Passing a tuple to
xticks (and similarly to
zticks) changes the position of the ticks and the labels:
plot!(xticks = ([0:π:3*π;], ["0", "\\pi", "2\\pi"])) yticks!([-1:1:1;], ["min", "zero", "max"])
Set attributes corresponding to a series line. Aliases:
l. The following are equivalent:
plot(y, line = (:steppre, :dot, :arrow, 0.5, 4, :red)) plot(y, seriestype = :steppre, linestyle = :dot, arrow = :arrow, linealpha = 0.5, linewidth = 4, linecolor = :red)
Set attributes corresponding to a series fill area. Aliases:
area. The following are equivalent:
plot(y, fill = (0, 0.5, :red)) plot(y, fillrange = 0, fillalpha = 0.5, fillcolor = :red)
Set attributes corresponding to a series marker. Aliases:
mark. The following are equivalent:
scatter(y, marker = (:hexagon, 20, 0.6, :green, stroke(3, 0.2, :black, :dot))) scatter(y, markershape = :hexagon, markersize = 20, markeralpha = 0.6, markercolor = :green, markerstrokewidth = 3, markerstrokealpha = 0.2, markerstrokecolor = :black, markerstrokestyle = :dot)
These attributes apply to individual series (lines, scatters, heatmaps, etc)
These attributes apply to the full Plot. (A Plot contains a tree-like layout of Subplots)
These attributes apply to settings for individual Subplots.
These attributes apply to an individual Axis in a Subplot (for example the