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
  • 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_font
  • legend_title_font
  • 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
source

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
source
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.

source
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)
source
PlotsBase.Commons.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).

source
PlotsBase.withFunction

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

with(:gr, size=(400,400), type=:histogram) do
  plot(rand(10))
  plot(rand(10))
end
source

Animations

PlotsBase.frameFunction
frame(animation[, plot])

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

source
PlotsBase.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.

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

Creates an .mov-file from an Animation object.

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

Creates an .mp4-file from an Animation object.

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

Creates an .webm-file from an Animation object.

source
PlotsBase.@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.
source
PlotsBase.@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.
source

Retriever

PlotsBase.backend_objectFunction
backend_object(plot)

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

source
PlotsBase.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/.

source

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