List of Plot Properties in Julia Plots
Description
In Julia’s Plots.jl
, a plot is also an object. If you draw an empty plot to check its type, it looks like this.
julia> using Plots
julia> p = plot()
julia> p |> typeof
Plots.Plot{Plots.GRBackend}
Removing Plots.
, it becomes Plot{GRBackend}
, meaning the plot’s backend is GR, similar to how a vector with elements of type Float64
is denoted as Vector{Float64}
. Checking the properties of Plot
, we find the following.
julia> p |> propertynames
(:backend, :n, :attr, :series_list, :o, :subplots, :spmap, :layout, :inset_subplots, :init)
Each property includes vectors or dictionaries containing attributes of the picture.
p.backend
This is the plot’s backend.
julia> p.backend
Plots.GRBackend()
p.attr
This is a dictionary about the attributes of the picture. It contains 30 key-value pairs as follows.
julia> plot(rand(10, 4), layout = 4).attr
RecipesPipeline.DefaultsDict with 30 entries:
:dpi => 100
:background_color_outside => :match
:plot_titlefontvalign => :vcenter
:warn_on_unsupported => true
:background_color => RGBA{Float64}(1.0,1.0,1.0,1.0)
:inset_subplots => nothing
:size => (600, 400)
:display_type => :auto
:overwrite_figure => true
:html_output_format => :auto
:plot_titlefontfamily => :match
:plot_titleindex => 0
:foreground_color => RGB{N0f8}(0.0,0.0,0.0)
:window_title => "Plots.jl"
:plot_titlefontrotation => 0.0
:extra_plot_kwargs => Dict{Any, Any}()
:pos => (0, 0)
:plot_titlefonthalign => :hcenter
:tex_output_standalone => false
:extra_kwargs => :series
:thickness_scaling => 1
:layout => 4
:plot_titlelocation => :center
:plot_titlefontsize => 16
:plot_title => ""
:show => false
:link => :none
:plot_titlefontcolor => :match
:plot_titlevspan => 0.05
:fontfamily => "sans-serif"
julia> plot(rand(10, 4), layout = 4).attr[:size]
(600, 400)
p.series_list
It is a vector whose elements are dictionaries of attributes for each data graph.
julia> plot(rand(10,5)).series_list
5-element Vector{Plots.Series}:
julia> plot(plot(rand(10, 4)), plot(rand(10, 3))).series_list
7-element Vector{Plots.Series}:
The included key-value pairs in each dictionary are as follows.
julia> plot(rand(10, 2)).series_list[1].plotattributes
RecipesPipeline.DefaultsDict with 62 entries:
:plot_object => Plot{Plots.GRBackend() n=2}
:subplot => Subplot{1}
:label => "y1"
:fillalpha => nothing
:linealpha => nothing
:linecolor => RGBA{Float64}(0.0,0.605603,0.97868,1.0)
:x_extrema => (NaN, NaN)
:series_index => 1
:markerstrokealpha => nothing
:markeralpha => nothing
:seriestype => :path
:z_extrema => (NaN, NaN)
:x => Base.OneTo(10)
:markerstrokecolor => RGBA{Float64}(0.0,0.0,0.0,1.0)
:fillcolor => RGBA{Float64}(0.0,0.605603,0.97868,1.0)
:clims_calculated => (NaN, NaN)
:seriescolor => RGBA{Float64}(0.0,0.605603,0.97868,1.0)
:extra_kwargs => Dict{Symbol, Any}()
:z => nothing
:series_plotindex => 1
:y => [0.477103, 0.00362131, 0.864524, 0.391488, 0.663659, 0.89787, 0.157973, 0.964416, 0.806635, 0.243531]
:markercolor => RGBA{Float64}(0.0,0.605603,0.97868,1.0)
:y_extrema => (0.00362131, 0.964416)
:linewidth => 1
:group => nothing
:stride => (1, 1)
:permute => :none
:marker_z => nothing
:show_empty_bins => false
:seriesalpha => nothing
:smooth => false
:zerror => nothing
:arrow => nothing
:normalize => false
:linestyle => :solid
:contours => false
:bar_width => nothing
:bins => :auto
:markerstrokestyle => :solid
:weights => nothing
:z_order => :front
:fill_z => nothing
:markershape => :none
:markerstrokewidth => 1
:xerror => nothing
:bar_position => :overlay
:contour_labels => false
:hover => nothing
:primary => true
:yerror => nothing
:ribbon => nothing
:fillstyle => nothing
:line_z => nothing
:orientation => :vertical
:markersize => 4
:bar_edges => false
:quiver => nothing
:fillrange => nothing
:colorbar_entry => true
:series_annotations => nothing
:levels => 15
:connections => nothing
julia> plot(rand(10, 2)).series_list[1][:label]
"y1"
Environment
- OS: Windows11
- Version: Julia 1.9.4, Plots v1.39.0