References

Contents

Index

Public Interface

Plot specification

RecipesBase.plotFunction

The main plot command. Use plot to create a new plot object, and plot! to add to an existing one:

    plot(args...; kw...)                  # creates a new plot window, and sets it to be the current
    plot!(args...; kw...)                 # adds to the `current`
    plot!(plotobj, args...; kw...)        # adds to the plot `plotobj`

There are lots of ways to pass in data, and lots of keyword arguments... just try it and it will likely work as expected. When you pass in matrices, it splits by columns. To see the list of available attributes, use the plotattr(attr) function, where attr is the symbol :Series, :Subplot, :Plot, or :Axis. Pass any attribute to plotattr as a String to look up its docstring, e.g., plotattr("seriestype").

Extended help

Series attributes

  • arrow
  • bar_edges
  • bar_position
  • bar_width
  • bins
  • colorbar_entry
  • connections
  • contour_labels
  • contours
  • extra_kwargs
  • fill
  • fill_z
  • fillalpha
  • fillcolor
  • fillrange
  • fillstyle
  • group
  • hover
  • label
  • levels
  • line
  • line_z
  • linealpha
  • linecolor
  • linestyle
  • linewidth
  • marker
  • marker_z
  • markeralpha
  • markercolor
  • markershape
  • markersize
  • markerstrokealpha
  • markerstrokecolor
  • markerstrokestyle
  • markerstrokewidth
  • normalize
  • orientation
  • permute
  • primary
  • quiver
  • ribbon
  • series_annotations
  • seriesalpha
  • seriescolor
  • seriestype
  • show_empty_bins
  • smooth
  • stride
  • subplot
  • weights
  • x
  • xerror
  • y
  • yerror
  • z
  • z_order
  • zerror

Axis attributes

Prepend these with the axis letter (x, y or z)

  • axis
  • discrete_values
  • draw_arrow
  • flip
  • foreground_color_axis
  • foreground_color_border
  • foreground_color_grid
  • foreground_color_guide
  • foreground_color_minor_grid
  • foreground_color_text
  • formatter
  • grid
  • gridalpha
  • gridlinewidth
  • gridstyle
  • guide
  • guide_position
  • guidefont
  • guidefontcolor
  • guidefontfamily
  • guidefonthalign
  • guidefontrotation
  • guidefontsize
  • guidefontvalign
  • lims
  • link
  • minorgrid
  • minorgridalpha
  • minorgridlinewidth
  • minorgridstyle
  • minorticks
  • mirror
  • rotation
  • scale
  • showaxis
  • tick_direction
  • tickfont
  • tickfontcolor
  • tickfontfamily
  • tickfonthalign
  • tickfontrotation
  • tickfontsize
  • tickfontvalign
  • ticks
  • unitformat
  • widen

Subplot attributes

  • annotationcolor
  • annotationfontfamily
  • annotationfontsize
  • annotationhalign
  • annotationrotation
  • annotations
  • annotationvalign
  • aspect_ratio
  • background_color_inside
  • background_color_subplot
  • bottom_margin
  • camera
  • clims
  • color_palette
  • colorbar
  • colorbar_continuous_values
  • colorbar_discrete_values
  • colorbar_fontfamily
  • colorbar_formatter
  • colorbar_scale
  • colorbar_tickfontcolor
  • colorbar_tickfontfamily
  • colorbar_tickfonthalign
  • colorbar_tickfontrotation
  • colorbar_tickfontsize
  • colorbar_tickfontvalign
  • colorbar_ticks
  • colorbar_title
  • colorbar_title_location
  • colorbar_titlefont
  • colorbar_titlefontcolor
  • colorbar_titlefontfamily
  • colorbar_titlefonthalign
  • colorbar_titlefontrotation
  • colorbar_titlefontsize
  • colorbar_titlefontvalign
  • extra_kwargs
  • fontfamily_subplot
  • foreground_color_subplot
  • foreground_color_title
  • framestyle
  • left_margin
  • legend_background_color
  • legend_column
  • legend_font
  • legend_font_color
  • legend_font_family
  • legend_font_halign
  • legend_font_pointsize
  • legend_font_rotation
  • legend_font_valign
  • legend_foreground_color
  • legend_position
  • legend_title
  • legend_title_font
  • legend_title_font_color
  • legend_title_font_family
  • legend_title_font_halign
  • legend_title_font_pointsize
  • legend_title_font_rotation
  • legend_title_font_valign
  • margin
  • plot_title_font
  • projection
  • projection_type
  • right_margin
  • subplot_index
  • title
  • title_font
  • titlefontcolor
  • titlefontfamily
  • titlefonthalign
  • titlefontrotation
  • titlefontsize
  • titlefontvalign
  • titlelocation
  • top_margin

Plot attributes

  • background_color
  • background_color_outside
  • display_type
  • dpi
  • extra_kwargs
  • extra_plot_kwargs
  • fontfamily
  • foreground_color
  • html_output_format
  • inset_subplots
  • layout
  • link
  • overwrite_figure
  • plot_title
  • plot_titlefontcolor
  • plot_titlefontfamily
  • plot_titlefonthalign
  • plot_titlefontrotation
  • plot_titlefontsize
  • plot_titlefontvalign
  • plot_titleindex
  • plot_titlelocation
  • plot_titlevspan
  • pos
  • show
  • size
  • tex_output_standalone
  • thickness_scaling
  • warn_on_unsupported
  • window_title

Extract a subplot from an existing plot.

Examples

julia> p1, p2 = plot(1:2), plot(10:20)
julia> pl = plot(p1, p2)  # plot containing 2 subplots

julia> plot(pl.subplots[1])  # extract 1st subplot as a standalone plot
julia> plot(pl.subplots[2])  # extract 2nd subplot as a standalone plot
Plots.bboxFunction
bbox(x, y, w, h [,originargs...])
bbox(layout)

Create a bounding box for plotting

RecipesBase.gridFunction
grid(args...; kw...)

Create a grid layout for subplots. args specify the dimensions, e.g. grid(3,2, widths = (0.6,0.4)) creates a grid with three rows and two columns of different width.

RecipesBase.@layoutMacro
@layout mat

Generate the subplots layout from a matrix of symbols (where subplots can span multiple rows or columns). Precise sizing can be achieved with curly brackets, otherwise the free space is equally split between the plot areas of subplots. You can use the _ character (underscore) to ignore plots in the layout (blank plots).

Examples

julia> @layout [a b; c]
2×1 Matrix{Any}:
 Any[(label = :a, blank = false) (label = :b, blank = false)]
 (label = :c, blank = false)

julia> @layout [a{0.3w}; b{0.2h}]
2×1 Matrix{Any}:
 (label = :a, width = 0.3, height = :auto)
 (label = :b, width = :auto, height = 0.2)

julia> @layout [_ ° _; ° ° °; ° ° °]
3×3 Matrix{Any}:
 (label = :_, blank = true)   …  (label = :_, blank = true)
 (label = :°, blank = false)     (label = :°, blank = false)
 (label = :°, blank = false)     (label = :°, blank = false)
Plots.defaultFunction

default(key) returns the current default value for that key.

default(key, value) sets the current default value for that key.

default(; kw...) will set the current default value for each key/value pair.

default(plotattributes, key) returns the key from plotattributes if it exists, otherwise default(key).

Plots.themeFunction
theme(s::Symbol)

Specify the colour theme for plots.

Plots.withFunction

Allows temporary setting of backend and defaults for Plots. Settings apply only for the do block. Example:

with(:gr, size=(400,400), type=:histogram) do
  plot(rand(10))
  plot(rand(10))
end
Plots.arrowMethod
arrow(args...)

Define arrowheads to apply to lines - args are style (:open or :closed), side (:head, :tail or :both), headlength and headwidth

Plots.coordsMethod

return the vertex points from a Shape or Segments object

Plots.fontMethod
font(args...)

Create a Font from a list of features. Values may be specified either as arguments (which are distinguished by type/value) or as keyword arguments.

Arguments

  • family: AbstractString. "serif" or "sans-serif" or "monospace"
  • pointsize: Integer. Size of font in points
  • halign: Symbol. Horizontal alignment (:hcenter, :left, or :right)
  • valign: Symbol. Vertical alignment (:vcenter, :top, or :bottom)
  • rotation: Real. Angle of rotation for text in degrees (use a non-integer type)
  • color: Colorant or Symbol

Examples

julia> font(8)
julia> font(family="serif", halign=:center, rotation=45.0)
Plots.makeshapeMethod

create a shape by picking points around the unit circle. n is the number of point/sides, offset is the starting angle

Plots.makestarMethod

create a star by weaving together points from an outer and inner circle. n is the number of arms

Plots.scaleFunction
scale(shape, x, y = x, c = center(shape))
scale!(shape, x, y = x, c = center(shape))

Scale shape by a factor.

Plots.scalefontsizesMethod
scalefontsizes(factor::Number)

Scales all current font sizes by factor. For example scalefontsizes(1.1) increases all current font sizes by 10%. To reset to initial sizes, use scalefontsizes()

Plots.strokeMethod
stroke(args...; alpha = nothing)

Define the properties of the stroke used in plotting lines

Plots.textMethod
text(string, args...; kw...)

Create a PlotText object wrapping a string with font info, for plot annotations. args and kw are passed to font.

Plots.translateFunction
translate(shape, x, y = x)
translate!(shape, x, y = x)

Translate a Shape in space.

Plots.weaveMethod

interleave 2 vectors into each other (like a zipper's teeth)

Plots.abline!Function

abline!([plot,] a, b; kwargs...)

Adds ax+b... straight line over the current plot, without changing the axis limits

Plots.annotate!Method
annotate!(anns)
annotate!(anns::Tuple...)
annotate!(x, y, txt)

Add annotations to an existing plot. Annotations are specified either as a vector of tuples, each of the form (x,y,txt), or as three vectors, x, y, txt. Each txt can be a String, PlotText PlotText (created with text(args...)), or a tuple of arguments to text (e.g., ("Label", 8, :red, :top)).

Example

julia> plot(1:10)
julia> annotate!([(7,3,"(7,3)"),(3,7,text("hey", 14, :left, :top, :green))])
julia> annotate!([(4, 4, ("More text", 8, 45.0, :bottom, :red))])
julia> annotate!([2,5], [6,3], ["text at (2,6)", "text at (5,3)"])
Plots.areaplotFunction
areaplot([x,] y)
areaplot!([x,] y)

Draw a stacked area plot of the matrix y.

Examples

julia> areaplot(1:3, [1 2 3; 7 8 9; 4 5 6], seriescolor = [:red :green :blue], fillalpha = [0.2 0.3 0.4])
Plots.bar!Method
bar(x,y)
bar!(x,y)

Make a bar plot of y vs x.

Keyword arguments

  • bar_position::Symbol: Choose from :overlay (default), :stack. (warning: may only be partially implemented). Aliases: (:bar_positions, :barpositions).
  • bar_width::Real: Width of bars in data coordinates. When nothing, chooses based on x (or y when orientation = :h). Aliases: (:bar_widths, :barwidths).
  • bar_edges::Bool: Align bars to edges (true), or centers (the default) ?.
  • fillrange::Union{Real, AbstractVector}: Fills area between fillrange and y for line-types, sets the base for bar, sticks types, and similar for other types. Aliases: (:fill_between, :fillbetween, :fillranges, :fillrng, :fillto, :frange).
  • permute::Tuple{Symbol, Symbol}: Permutes data and axis properties of the axes given in the tuple, e.g. (:x, :y). Aliases: (:permutes,).

Examples

julia> bar([1,2,3],[4,5,6],fillcolor=[:red,:green,:blue],fillalpha=[0.2,0.4,0.6])
julia> bar([(1,4),(2,5),(3,6)])
Plots.barMethod
bar(x,y)
bar!(x,y)

Make a bar plot of y vs x.

Keyword arguments

  • bar_position::Symbol: Choose from :overlay (default), :stack. (warning: may only be partially implemented). Aliases: (:bar_positions, :barpositions).
  • bar_width::Real: Width of bars in data coordinates. When nothing, chooses based on x (or y when orientation = :h). Aliases: (:bar_widths, :barwidths).
  • bar_edges::Bool: Align bars to edges (true), or centers (the default) ?.
  • fillrange::Union{Real, AbstractVector}: Fills area between fillrange and y for line-types, sets the base for bar, sticks types, and similar for other types. Aliases: (:fill_between, :fillbetween, :fillranges, :fillrng, :fillto, :frange).
  • permute::Tuple{Symbol, Symbol}: Permutes data and axis properties of the axes given in the tuple, e.g. (:x, :y). Aliases: (:permutes,).

Examples

julia> bar([1,2,3],[4,5,6],fillcolor=[:red,:green,:blue],fillalpha=[0.2,0.4,0.6])
julia> bar([(1,4),(2,5),(3,6)])
Plots.barhist!Method
barhist(x)
barhist!(x)

Make a histogram bar plot. See histogram.

Plots.barhistMethod
barhist(x)
barhist!(x)

Make a histogram bar plot. See histogram.

Plots.boxplot!Method
boxplot(x, y)
boxplot!(x, y)

Make a box and whisker plot.

Keyword arguments

  • notch: Bool. Notch the box plot? (false)
  • whisker_range: Real. Whiskers extend whisker_range*IQR below the first quartile and above the third quartile. Values outside this range are shown as outliers (1.5)
  • outliers: Bool. Show outliers? (true)
  • whisker_width: Real or Symbol. Length of whiskers; the options are :match to match the box width, :half, or a number to indicate the total length. (:half)

Example

julia> using StatsPlots
julia> boxplot(repeat([1,2,3],outer=100),randn(300))
Plots.boxplotMethod
boxplot(x, y)
boxplot!(x, y)

Make a box and whisker plot.

Keyword arguments

  • notch: Bool. Notch the box plot? (false)
  • whisker_range: Real. Whiskers extend whisker_range*IQR below the first quartile and above the third quartile. Values outside this range are shown as outliers (1.5)
  • outliers: Bool. Show outliers? (true)
  • whisker_width: Real or Symbol. Length of whiskers; the options are :match to match the box width, :half, or a number to indicate the total length. (:half)

Example

julia> using StatsPlots
julia> boxplot(repeat([1,2,3],outer=100),randn(300))
Plots.contour!Method
contour(x,y,z)
contour!(x,y,z)

Draw contour lines of the surface z.

Arguments

  • levels: Contour levels (if AbstractVector) or number of levels (if Integer)
  • fill: Bool. Fill area between contours or draw contours only (false by default)

Example

julia> x = y = range(-20, stop = 20, length = 100)
julia> contour(x, y, (x, y) -> x^2 + y^2)
Plots.contourMethod
contour(x,y,z)
contour!(x,y,z)

Draw contour lines of the surface z.

Arguments

  • levels: Contour levels (if AbstractVector) or number of levels (if Integer)
  • fill: Bool. Fill area between contours or draw contours only (false by default)

Example

julia> x = y = range(-20, stop = 20, length = 100)
julia> contour(x, y, (x, y) -> x^2 + y^2)
Plots.curves!Method
curves(x,y)
curves!(x,y)

Draw a Bezier curve from (x[1],y[1]) to (x[end],y[end]) with control points (x[2],y[2]), ..., (x[end-1],y[end]-1).

Keyword arguments

  • fillrange::Union{Real, AbstractVector}: Fills area between fillrange and y for line-types, sets the base for bar, sticks types, and similar for other types. Aliases: (:fill_between, :fillbetween, :fillranges, :fillrng, :fillto, :frange).

Example

julia> curves([1,2,3,4],[1,1,2,4])
Plots.curvesMethod
curves(x,y)
curves!(x,y)

Draw a Bezier curve from (x[1],y[1]) to (x[end],y[end]) with control points (x[2],y[2]), ..., (x[end-1],y[end]-1).

Keyword arguments

  • fillrange::Union{Real, AbstractVector}: Fills area between fillrange and y for line-types, sets the base for bar, sticks types, and similar for other types. Aliases: (:fill_between, :fillbetween, :fillranges, :fillrng, :fillto, :frange).

Example

julia> curves([1,2,3,4],[1,1,2,4])
Plots.density!Method
density(x)
density!(x)

Make a line plot of a kernel density estimate of x. The smoothness of the density plot is defined from bandwidth (real positive number).

Arguments

  • x: AbstractVector of samples for probability density estimation

Keyword arguments

  • trim::Bool: enables cutting off the distribution tails.
  • bandwidth::Number: a low bandwidth induces under-smoothing, whilst a high bandwidth induces over-smoothing.

Examples

julia> density(randn(100), bandwidth = -0.01, trim = false)
output : ERROR: Bandwidth must be positive

julia> density(randn(100), bandwidth = 0.1, trim = false)  # a curve with extremity and under-smoothing
julia> density(randn(100), bandwidth = 10, trim = true)  # a curve without extremity and over-smoothing

Example

julia> using StatsPlots
julia> density(randn(100_000))
Plots.densityMethod
density(x)
density!(x)

Make a line plot of a kernel density estimate of x. The smoothness of the density plot is defined from bandwidth (real positive number).

Arguments

  • x: AbstractVector of samples for probability density estimation

Keyword arguments

  • trim::Bool: enables cutting off the distribution tails.
  • bandwidth::Number: a low bandwidth induces under-smoothing, whilst a high bandwidth induces over-smoothing.

Examples

julia> density(randn(100), bandwidth = -0.01, trim = false)
output : ERROR: Bandwidth must be positive

julia> density(randn(100), bandwidth = 0.1, trim = false)  # a curve with extremity and under-smoothing
julia> density(randn(100), bandwidth = 10, trim = true)  # a curve without extremity and over-smoothing

Example

julia> using StatsPlots
julia> density(randn(100_000))
Plots.heatmap!Method
heatmap(x,y,z)
heatmap!(x,y,z)

Plot a heatmap of the rectangular array z.

Keyword arguments

  • aspect_ratio::Union{Real, Symbol}: Plot area is resized so that 1 y-unit is the same size as aspect_ratio x-units. With :none, images inherit aspect ratio of the plot area. Use :equal for unit aspect ratio. Aliases: (:aspectratios, :aspectratio, :aspectratios, :axisratio, :axisratio, :ratio).

Example

julia> heatmap(randn(10,10))
Plots.heatmapMethod
heatmap(x,y,z)
heatmap!(x,y,z)

Plot a heatmap of the rectangular array z.

Keyword arguments

  • aspect_ratio::Union{Real, Symbol}: Plot area is resized so that 1 y-unit is the same size as aspect_ratio x-units. With :none, images inherit aspect ratio of the plot area. Use :equal for unit aspect ratio. Aliases: (:aspectratios, :aspectratio, :aspectratios, :axisratio, :axisratio, :ratio).

Example

julia> heatmap(randn(10,10))
Plots.hexbin!Method
hexbin(x,y)
hexbin!(x,y)

Make a hexagonal binning plot (a histogram of the observations (x[i],y[i]) with hexagonal bins).

Example

julia> hexbin(randn(10_000), randn(10_000))
Plots.hexbinMethod
hexbin(x,y)
hexbin!(x,y)

Make a hexagonal binning plot (a histogram of the observations (x[i],y[i]) with hexagonal bins).

Example

julia> hexbin(randn(10_000), randn(10_000))
Plots.histogram!Method
histogram(x)
histogram!(x)

Plot a histogram.

Arguments

  • x: AbstractVector of values to be binned
  • bins::Union{Integer, Symbol, Tuple{Integer, Integer}, AbstractVector}: Default is :auto (the Freedman-Diaconis rule). For histogram-types, defines the approximate number of bins to aim for, or the auto-binning algorithm to use (:sturges, :sqrt, :rice, :scott or :fd). For fine-grained control pass a Vector of break values, e.g. range(minimum(x), stop = maximum(x), length = 25). Aliases: (:bin, :nb, :nbin, :nbins).
  • weights: Vector of weights for the values in x, for weighted bin counts
  • normalize::Union{Bool, Symbol}: Histogram normalization mode. Possible values are: false/:none (no normalization, default), true/:pdf (normalize to a discrete PDF, where the total area of the bins is 1), :probability (bin heights sum to 1) and :density (the area of each bin, rather than the height, is equal to the counts - useful for uneven bin sizes). Aliases: (:norm, :normalized, :normalizes, :normed).
  • bar_position::Symbol: Choose from :overlay (default), :stack. (warning: may only be partially implemented). Aliases: (:bar_positions, :barpositions).
  • bar_width::Real: Width of bars in data coordinates. When nothing, chooses based on x (or y when orientation = :h). Aliases: (:bar_widths, :barwidths).
  • bar_edges::Bool: Align bars to edges (true), or centers (the default) ?.
  • permute::Tuple{Symbol, Symbol}: Permutes data and axis properties of the axes given in the tuple, e.g. (:x, :y). Aliases: (:permutes,).

Example

julia> histogram([1,2,1,1,4,3,8],bins=0:8)
julia> histogram([1,2,1,1,4,3,8],bins=0:8,weights=weights([4,7,3,9,12,2,6]))
Plots.histogramMethod
histogram(x)
histogram!(x)

Plot a histogram.

Arguments

  • x: AbstractVector of values to be binned
  • bins::Union{Integer, Symbol, Tuple{Integer, Integer}, AbstractVector}: Default is :auto (the Freedman-Diaconis rule). For histogram-types, defines the approximate number of bins to aim for, or the auto-binning algorithm to use (:sturges, :sqrt, :rice, :scott or :fd). For fine-grained control pass a Vector of break values, e.g. range(minimum(x), stop = maximum(x), length = 25). Aliases: (:bin, :nb, :nbin, :nbins).
  • weights: Vector of weights for the values in x, for weighted bin counts
  • normalize::Union{Bool, Symbol}: Histogram normalization mode. Possible values are: false/:none (no normalization, default), true/:pdf (normalize to a discrete PDF, where the total area of the bins is 1), :probability (bin heights sum to 1) and :density (the area of each bin, rather than the height, is equal to the counts - useful for uneven bin sizes). Aliases: (:norm, :normalized, :normalizes, :normed).
  • bar_position::Symbol: Choose from :overlay (default), :stack. (warning: may only be partially implemented). Aliases: (:bar_positions, :barpositions).
  • bar_width::Real: Width of bars in data coordinates. When nothing, chooses based on x (or y when orientation = :h). Aliases: (:bar_widths, :barwidths).
  • bar_edges::Bool: Align bars to edges (true), or centers (the default) ?.
  • permute::Tuple{Symbol, Symbol}: Permutes data and axis properties of the axes given in the tuple, e.g. (:x, :y). Aliases: (:permutes,).

Example

julia> histogram([1,2,1,1,4,3,8],bins=0:8)
julia> histogram([1,2,1,1,4,3,8],bins=0:8,weights=weights([4,7,3,9,12,2,6]))
Plots.histogram2d!Method
histogram2d(x,y)
histogram2d!(x,y)

Plot a two-dimensional histogram.

Arguments

  • bins: Number of bins (if an Integer) or bin edges (if an AbtractVector)
  • weights: Vector of weights for the values in x. Each entry of x contributes its weight to the height of its bin.

Example

julia> histogram2d(randn(10_000),randn(10_000))
Plots.histogram2dMethod
histogram2d(x,y)
histogram2d!(x,y)

Plot a two-dimensional histogram.

Arguments

  • bins: Number of bins (if an Integer) or bin edges (if an AbtractVector)
  • weights: Vector of weights for the values in x. Each entry of x contributes its weight to the height of its bin.

Example

julia> histogram2d(randn(10_000),randn(10_000))
Plots.hline!Method
hline(y)
hline!(y)

Draw horizontal lines at positions specified by the values in the AbstractVector y.

Example

julia> hline([-1,0,2])
Plots.hlineMethod
hline(y)
hline!(y)

Draw horizontal lines at positions specified by the values in the AbstractVector y.

Example

julia> hline([-1,0,2])
Plots.hspan!Method
hspan(y)

Draw a rectangle between the horizontal line at position y[1] and the horizontal line at position y[2]. If length(y) ≥ 4, then further rectangles are drawn between y[3] and y[4], y[5] and y[6], and so on. If length(y) is odd, then the last entry of y is ignored.

Example

julia> hspan(1:6)
Plots.hspanMethod
hspan(y)

Draw a rectangle between the horizontal line at position y[1] and the horizontal line at position y[2]. If length(y) ≥ 4, then further rectangles are drawn between y[3] and y[4], y[5] and y[6], and so on. If length(y) is odd, then the last entry of y is ignored.

Example

julia> hspan(1:6)
Plots.lens!Function
lens!([plot,] x, y, inset = (sp_index, bbox(x1, x2, y1, y2)))

Magnify a region of a plot given by x and y. sp_index is the index of the subplot and x1, x2, y1 and y2 should be between 0 and 1.

Plots.mesh3d!Method
mesh3d(x,y,z)
mesh3d(x,y,z; connections)

Plot a 3d mesh. On Plotly the triangles can be specified using the connections argument.

Example

x=[0, 1, 2, 0]
y=[0, 0, 1, 2]
z=[0, 2, 0, 1]

i=[0, 0, 0, 1]
j=[1, 2, 3, 2]
k=[2, 3, 1, 3]

plot(x,y,z,seriestype=:mesh3d;connections=(i,j,k))
Plots.mesh3dMethod
mesh3d(x,y,z)
mesh3d(x,y,z; connections)

Plot a 3d mesh. On Plotly the triangles can be specified using the connections argument.

Example

x=[0, 1, 2, 0]
y=[0, 0, 1, 2]
z=[0, 2, 0, 1]

i=[0, 0, 0, 1]
j=[1, 2, 3, 2]
k=[2, 3, 1, 3]

plot(x,y,z,seriestype=:mesh3d;connections=(i,j,k))
Plots.ohlc!Method
ohlc(x,y::Vector{OHLC})
ohlc!(x,y::Vector{OHLC})

Make open-high-low-close plot. Each entry of y is represented by a vertical segment extending from the low value to the high value, with short horizontal segments on the left and right indicating the open and close values, respectively.

Example

julia> meanprices = cumsum(randn(100))
julia> y = OHLC[(p+rand(),p+1,p-1,p+rand()) for p in meanprices]
julia> ohlc(y)
Plots.ohlcMethod
ohlc(x,y::Vector{OHLC})
ohlc!(x,y::Vector{OHLC})

Make open-high-low-close plot. Each entry of y is represented by a vertical segment extending from the low value to the high value, with short horizontal segments on the left and right indicating the open and close values, respectively.

Example

julia> meanprices = cumsum(randn(100))
julia> y = OHLC[(p+rand(),p+1,p-1,p+rand()) for p in meanprices]
julia> ohlc(y)
Plots.path3d!Method
path3d(x,y,z)
path3d!(x,y,z)

Plot a 3D path from (x[1],y[1],z[1]) to (x[2],y[2],z[2]), ..., to (x[end],y[end],z[end]).

Example

julia> path3d([0,1,2,3],[0,1,4,9],[0,1,8,27])
Plots.path3dMethod
path3d(x,y,z)
path3d!(x,y,z)

Plot a 3D path from (x[1],y[1],z[1]) to (x[2],y[2],z[2]), ..., to (x[end],y[end],z[end]).

Example

julia> path3d([0,1,2,3],[0,1,4,9],[0,1,8,27])
Plots.pie!Method
pie(x, y)

Plot a pie diagram.

Example

x = ["Nerds","Hackers","Scientists"]
y = [0.4,0.35,0.25]
pie(x, y, title="The Julia Community")
Plots.pieMethod
pie(x, y)

Plot a pie diagram.

Example

x = ["Nerds","Hackers","Scientists"]
y = [0.4,0.35,0.25]
pie(x, y, title="The Julia Community")
Plots.quiver!Method
quiver(x,y,quiver=(u,v))
quiver!(x,y,quiver=(u,v))

Make a quiver (vector field) plot. The ith vector extends from (x[i],y[i]) to (x[i] + u[i], y[i] + v[i]).

Keyword arguments

  • arrow::Union{Bool, Plots.Arrow}: Defines arrowheads that should be displayed at the end of path line segments (just before a NaN and the last non-NaN point). Used in quiverplot, streamplot, or similar. Aliases: (:arrows,).

Example

julia> quiver([1,2,3],[3,2,1],quiver=([1,1,1],[1,2,3]))
Plots.quiverMethod
quiver(x,y,quiver=(u,v))
quiver!(x,y,quiver=(u,v))

Make a quiver (vector field) plot. The ith vector extends from (x[i],y[i]) to (x[i] + u[i], y[i] + v[i]).

Keyword arguments

  • arrow::Union{Bool, Plots.Arrow}: Defines arrowheads that should be displayed at the end of path line segments (just before a NaN and the last non-NaN point). Used in quiverplot, streamplot, or similar. Aliases: (:arrows,).

Example

julia> quiver([1,2,3],[3,2,1],quiver=([1,1,1],[1,2,3]))
Plots.scatter!Method
scatter(x,y)
scatter!(x,y)

Make a scatter plot of y vs x.

Keyword arguments

  • markersize::Union{Real, AbstractVector}: Size (radius pixels) of the markers. Aliases: (:markersizes, :ms, :msize).
  • markercolor::Union{Integer, Symbol, ColorSchemes.ColorScheme, ColorTypes.Colorant}: Color of the interior of the marker or shape. :match will take the value from :seriescolor. Aliases: (:markercolors, :markercolour, :mc, :mcolor, :mcolour).
  • markershape::Union{Symbol, Plots.Shape, AbstractVector}: Choose from [:none, :auto, :circle, :rect, :star5, :diamond, :hexagon, :cross, :xcross, :utriangle, :dtriangle, :rtriangle, :ltriangle, :pentagon, :heptagon, :octagon, :star4, :star6, :star7, :star8, :vline, :hline, :+, :x]. Aliases: (:markershapes, :shape).
  • markeralpha::Real: The alpha/opacity override for the marker interior. nothing (the default) means it will take the alpha value of markercolor. Aliases: (:ma, :malpha, :markeralphas, :markeropacity, :mopacity, :mα).

Examples

julia> scatter([1,2,3],[4,5,6],markersize=[3,4,5],markercolor=[:red,:green,:blue])
julia> scatter([(1,4),(2,5),(3,6)])
Plots.scatterMethod
scatter(x,y)
scatter!(x,y)

Make a scatter plot of y vs x.

Keyword arguments

  • markersize::Union{Real, AbstractVector}: Size (radius pixels) of the markers. Aliases: (:markersizes, :ms, :msize).
  • markercolor::Union{Integer, Symbol, ColorSchemes.ColorScheme, ColorTypes.Colorant}: Color of the interior of the marker or shape. :match will take the value from :seriescolor. Aliases: (:markercolors, :markercolour, :mc, :mcolor, :mcolour).
  • markershape::Union{Symbol, Plots.Shape, AbstractVector}: Choose from [:none, :auto, :circle, :rect, :star5, :diamond, :hexagon, :cross, :xcross, :utriangle, :dtriangle, :rtriangle, :ltriangle, :pentagon, :heptagon, :octagon, :star4, :star6, :star7, :star8, :vline, :hline, :+, :x]. Aliases: (:markershapes, :shape).
  • markeralpha::Real: The alpha/opacity override for the marker interior. nothing (the default) means it will take the alpha value of markercolor. Aliases: (:ma, :malpha, :markeralphas, :markeropacity, :mopacity, :mα).

Examples

julia> scatter([1,2,3],[4,5,6],markersize=[3,4,5],markercolor=[:red,:green,:blue])
julia> scatter([(1,4),(2,5),(3,6)])
Plots.scatter3d!Method
scatter3d(x,y,z)
scatter3d!(x,y,z)

Make a 3D scatter plot.

Example

julia> scatter3d([0,1,2,3],[0,1,4,9],[0,1,8,27])
Plots.scatter3dMethod
scatter3d(x,y,z)
scatter3d!(x,y,z)

Make a 3D scatter plot.

Example

julia> scatter3d([0,1,2,3],[0,1,4,9],[0,1,8,27])
Plots.scatterhist!Method
scatterhist(x)
scatterhist!(x)

Make a histogram scatter plot (bin counts are represented using points instead of bars). See histogram.

Plots.scatterhistMethod
scatterhist(x)
scatterhist!(x)

Make a histogram scatter plot (bin counts are represented using points instead of bars). See histogram.

Plots.stephist!Method
stephist(x)
stephist!(x)

Make a histogram step plot (bin counts are represented using horizontal lines instead of bars). See histogram.

Plots.stephistMethod
stephist(x)
stephist!(x)

Make a histogram step plot (bin counts are represented using horizontal lines instead of bars). See histogram.

Plots.sticks!Method
sticks(x,y)
sticks!(x,y)

Draw a stick plot of y vs x.

Arguments

  • fillrange::Union{Real, AbstractVector}: Fills area between fillrange and y for line-types, sets the base for bar, sticks types, and similar for other types. Aliases: (:fill_between, :fillbetween, :fillranges, :fillrng, :fillto, :frange).
  • markershape::Union{Symbol, Plots.Shape, AbstractVector}: Choose from [:none, :auto, :circle, :rect, :star5, :diamond, :hexagon, :cross, :xcross, :utriangle, :dtriangle, :rtriangle, :ltriangle, :pentagon, :heptagon, :octagon, :star4, :star6, :star7, :star8, :vline, :hline, :+, :x]. Aliases: (:markershapes, :shape).

Example

julia> sticks(1:10)
Plots.sticksMethod
sticks(x,y)
sticks!(x,y)

Draw a stick plot of y vs x.

Arguments

  • fillrange::Union{Real, AbstractVector}: Fills area between fillrange and y for line-types, sets the base for bar, sticks types, and similar for other types. Aliases: (:fill_between, :fillbetween, :fillranges, :fillrng, :fillto, :frange).
  • markershape::Union{Symbol, Plots.Shape, AbstractVector}: Choose from [:none, :auto, :circle, :rect, :star5, :diamond, :hexagon, :cross, :xcross, :utriangle, :dtriangle, :rtriangle, :ltriangle, :pentagon, :heptagon, :octagon, :star4, :star6, :star7, :star8, :vline, :hline, :+, :x]. Aliases: (:markershapes, :shape).

Example

julia> sticks(1:10)
Plots.surface!Method
surface(x,y,z)
surface!(x,y,z)

Draw a 3D surface plot.

Example

julia> using LinearAlgebra
julia> x = y = range(-3, stop = 3, length = 100)
julia> surface(x, y, (x, y) -> sinc(norm([x, y])))
Plots.surfaceMethod
surface(x,y,z)
surface!(x,y,z)

Draw a 3D surface plot.

Example

julia> using LinearAlgebra
julia> x = y = range(-3, stop = 3, length = 100)
julia> surface(x, y, (x, y) -> sinc(norm([x, y])))
Plots.violin!Method
violin(x,y,z)
violin!(x,y,z)

Make a violin plot.

Example

julia> violin(repeat([1,2,3],outer=100),randn(300))
Plots.violinMethod
violin(x,y,z)
violin!(x,y,z)

Make a violin plot.

Example

julia> violin(repeat([1,2,3],outer=100),randn(300))
Plots.vline!Method
vline(x)
vline!(x)

Draw vertical lines at positions specified by the values in the AbstractVector x.

Example

julia> vline([-1,0,2])
Plots.vlineMethod
vline(x)
vline!(x)

Draw vertical lines at positions specified by the values in the AbstractVector x.

Example

julia> vline([-1,0,2])
Plots.vspan!Method
vspan(x)

Draw a rectangle between the vertical line at position x[1] and the vertical line at position x[2]. If length(x) ≥ 4, then further rectangles are drawn between x[3] and x[4], x[5] and x[6], and so on. If length(x) is odd, then the last entry of x is ignored.

Example

julia> vspan(1:6)
Plots.vspanMethod
vspan(x)

Draw a rectangle between the vertical line at position x[1] and the vertical line at position x[2]. If length(x) ≥ 4, then further rectangles are drawn between x[3] and x[4], x[5] and x[6], and so on. If length(x) is odd, then the last entry of x is ignored.

Example

julia> vspan(1:6)
Plots.wireframe!Method
wireframe(x,y,z)
wireframe!(x,y,z)

Draw a 3D wireframe plot.

Example

julia> wireframe(1:10,1:10,randn(10,10))
Plots.wireframeMethod
wireframe(x,y,z)
wireframe!(x,y,z)

Draw a 3D wireframe plot.

Example

julia> wireframe(1:10,1:10,randn(10,10))
Plots.xaxis!Method

Specify x axis attributes for an existing plot

Plots.xerror!Method
xerror(x, y [, z]; xerror = vals)
xerror!(x, y [, z]; xerror = vals)

Create or add a series of xerrorbars at the positions defined by x, y and z with the lenghts defined in vals.

Markerstrokecolor will color the whole errorbars if not specified otherwise.

Plots.xerrorMethod
xerror(x, y [, z]; xerror = vals)
xerror!(x, y [, z]; xerror = vals)

Create or add a series of xerrorbars at the positions defined by x, y and z with the lenghts defined in vals.

Markerstrokecolor will color the whole errorbars if not specified otherwise.

Plots.xgrid!Method

Specify x grid attributes for an existing plot

Plots.yaxis!Method

Specify y axis attributes for an existing plot

Plots.yerror!Method
yerror(x, y [, z]; yerror = vals)
yerror!(x, y [, z]; yerror = vals)

Create or add a series of yerrorbars at the positions defined by x, y and z with the lenghts defined in vals.

Markerstrokecolor will color the whole errorbars if not specified otherwise.

Plots.yerrorMethod
yerror(x, y [, z]; yerror = vals)
yerror!(x, y [, z]; yerror = vals)

Create or add a series of yerrorbars at the positions defined by x, y and z with the lenghts defined in vals.

Markerstrokecolor will color the whole errorbars if not specified otherwise.

Plots.ygrid!Method

Specify y grid attributes for an existing plot

Plots.zaxis!Method

Specify z axis attributes for an existing plot

Plots.zerror!Method
zerror(x, y [, z]; zerror = vals)
zerror!(x, y [, z]; zerror = vals)

Create or add a series of zerrorbars at the positions defined by x, y and z with the lenghts defined in vals.

Markerstrokecolor will color the whole errorbars if not specified otherwise.

Plots.zerrorMethod
zerror(x, y [, z]; zerror = vals)
zerror!(x, y [, z]; zerror = vals)

Create or add a series of zerrorbars at the positions defined by x, y and z with the lenghts defined in vals.

Markerstrokecolor will color the whole errorbars if not specified otherwise.

Plots.zgrid!Method

Specify z grid attributes for an existing plot

Animations

RecipesBase.animateFunction

Animate from an iterator which returns the plot args each iteration.

Plots.frameFunction
frame(animation[, plot])

Add a plot (the current plot if not specified) to an existing animation

Plots.gifFunction
gif(animation[, filename]; fps=20, loop=0, variable_palette=false, verbose=false, show_msg=true)

Creates an animated .gif-file from an Animation object.

Plots.movFunction
mov(animation[, filename]; fps=20, loop=0, verbose=false, show_msg=true)

Creates an .mov-file from an Animation object.

Plots.mp4Function
mp4(animation[, filename]; fps=20, loop=0, verbose=false, show_msg=true)

Creates an .mp4-file from an Animation object.

Plots.webmFunction
webm(animation[, filename]; fps=20, loop=0, verbose=false, show_msg=true)

Creates an .webm-file from an Animation object.

Plots.@animateMacro

Collect one frame per for-block iteration and return an Animation object.

Example:

p = plot(1)
anim = @animate for x=0:0.1:5
    push!(p, 1, sin(x))
end
gif(anim)

This macro supports additional parameters, that may be added after the main loop body.

  • Add every n with positive Integer n, to take only one frame every nth iteration.
  • Add when <cond> where <cond> is an Expression resulting in a Boolean, to take a frame only when <cond> returns true. Is incompatible with every.
Plots.@gifMacro

Builds an Animation using one frame per loop iteration, then create an animated GIF.

Example:

  p = plot(1)
  @gif for x=0:0.1:5
    push!(p, 1, sin(x))
  end

This macro supports additional parameters, that may be added after the main loop body.

  • Add fps=n with positive Integer n, to specify the desired frames per second.
  • Add every n with positive Integer n, to take only one frame every nth iteration.
  • Add when <cond> where <cond> is an Expression resulting in a Boolean, to take a frame only when <cond> returns true. Is incompatible with every.

Retriever

Plots.currentFunction
current()

Returns the Plot object for the current plot

Plots.xlimsFunction
xlims([plt])

Returns the x axis limits of the current plot or subplot

Plots.ylimsFunction
ylims([plt])

Returns the y axis limits of the current plot or subplot

Plots.zlimsFunction
zlims([plt])

Returns the z axis limits of the current plot or subplot

Plots.backend_objectFunction
backend_object(plot)

Returns the backend representation of a Plot object. Returns nothing if the backend does not support this.

Plots.plotattrFunction
plotattr([attr])

Look up the properties of a Plots attribute, or specify an attribute type. Options are Series, Subplot, Plot, Axis. Call plotattr() to search for an attribute via fuzzy finding. The information is the same as that given on https://docs.juliaplots.org/latest/attributes/.

Output

Base.Multimedia.displayFunction
display(x)
display(d::AbstractDisplay, x)
display(mime, x)
display(d::AbstractDisplay, mime, x)

Display x using the topmost applicable display in the display stack, typically using the richest supported multimedia output for x, with plain-text stdout output as a fallback. The display(d, x) variant attempts to display x on the given display d only, throwing a MethodError if d cannot display objects of this type.

In general, you cannot assume that display output goes to stdout (unlike print(x) or show(x)). For example, display(x) may open up a separate window with an image. display(x) means "show x in the best way you can for the current output device(s)." If you want REPL-like text output that is guaranteed to go to stdout, use show(stdout, "text/plain", x) instead.

There are also two variants with a mime argument (a MIME type string, such as "image/png"), which attempt to display x using the requested MIME type only, throwing a MethodError if this type is not supported by either the display(s) or by x. With these variants, one can also supply the "raw" data in the requested MIME type by passing x::AbstractString (for MIME types with text-based storage, such as text/html or application/postscript) or x::Vector{UInt8} (for binary MIME types).

To customize how instances of a type are displayed, overload show rather than display, as explained in the manual section on custom pretty-printing.

source
Plots.addExtensionMethod
addExtension(filepath, extension)

Change filepath extension according to the extension map

Plots.closeallMethod

Close all open gui windows of the current backend

Plots.epsFunction
eps([plot,], filename)

Save plot as eps-file.

Plots.guiFunction
gui([plot])

Display a plot using the backends' gui window

Plots.htmlFunction
html([plot,], filename)

Save plot as html-file.

Plots.jsonFunction
json([plot,], filename)

Save plot as json-file.

Plots.pdfFunction
pdf([plot,], filename)

Save plot as pdf-file.

Plots.pngFunction
png([plot,], filename)

Save plot as png-file.

Plots.psFunction
ps([plot,], filename)

Save plot as ps-file.

Plots.savefigMethod
savefig([plot,] filename)

Save a Plot (the current plot if plot is not passed) to file. The file type is inferred from the file extension. All backends support png and pdf file types, some also support svg, ps, eps, html and tex.

Plots.svgFunction
svg([plot,], filename)

Save plot as svg-file.

Plots.texFunction
tex([plot,], filename)

Save plot as tex-file.

Plots.txtFunction
txt([plot,], filename)

Save plot as txt-file.