Merge remote-tracking branch 'upstream/master' into patch-4
This commit is contained in:
commit
8837613a0b
18
Project.toml
18
Project.toml
@ -1,12 +1,13 @@
|
||||
name = "Plots"
|
||||
uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
|
||||
author = ["Tom Breloff (@tbreloff)"]
|
||||
version = "1.21.1"
|
||||
version = "1.22.1"
|
||||
|
||||
[deps]
|
||||
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
|
||||
Contour = "d38c429a-6771-53c6-b99e-75d170b6e991"
|
||||
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
|
||||
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
|
||||
FFMPEG = "c87230d0-a227-11e9-1b43-d7ebe4e7570a"
|
||||
FixedPointNumbers = "53c48c17-4a7d-5ca2-90c5-79b7896eea93"
|
||||
GR = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"
|
||||
@ -31,28 +32,27 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
|
||||
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
|
||||
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
|
||||
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
|
||||
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
|
||||
|
||||
[compat]
|
||||
Contour = "0.5"
|
||||
FFMPEG = "0.2, 0.3, 0.4"
|
||||
FixedPointNumbers = "0.6, 0.7, 0.8"
|
||||
GR = "0.53, 0.54, 0.55, 0.57, 0.58"
|
||||
FFMPEG = "0.2 - 0.4"
|
||||
FixedPointNumbers = "0.6 - 0.8"
|
||||
GR = "0.53 - 0.59"
|
||||
GeometryBasics = "0.2, 0.3.1, 0.4"
|
||||
JSON = "0.21, 1"
|
||||
Latexify = "0.14, 0.15"
|
||||
Latexify = "0.14 - 0.15"
|
||||
Measures = "0.3"
|
||||
NaNMath = "0.3"
|
||||
PlotThemes = "2"
|
||||
PlotUtils = "1"
|
||||
RecipesBase = "1"
|
||||
RecipesPipeline = "0.3.5"
|
||||
RecipesPipeline = "0.3.5, 0.4"
|
||||
Reexport = "0.2, 1.0"
|
||||
Requires = "1"
|
||||
Scratch = "1"
|
||||
Showoff = "0.3.1, 1.0"
|
||||
StatsBase = "0.32, 0.33"
|
||||
UnicodePlots = "2"
|
||||
StatsBase = "0.32 - 0.33"
|
||||
UnicodePlots = "2.4"
|
||||
julia = "1.5"
|
||||
|
||||
[extras]
|
||||
|
||||
42
deps/SnoopCompile/precompile/precompile_Plots.jl
vendored
42
deps/SnoopCompile/precompile/precompile_Plots.jl
vendored
@ -82,19 +82,14 @@ function _precompile_()
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:grid, :lims, :flip), Tuple{Bool, Tuple{Float64, Float64}, Bool}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:grid, :minorgrid, :guide), Tuple{Bool, Bool, String}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:grid, :minorgrid, :mirror, :guide), Tuple{Bool, Bool, Bool, String}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:grid,), Tuple{Bool}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:gridlinewidth, :grid, :gridalpha, :gridstyle, :foreground_color_grid), Tuple{Int64, Bool, Float64, Symbol, RGBA{Float64}}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:guide,), Tuple{String}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:guide_position, :guidefontvalign, :mirror, :guide), Tuple{Symbol, Symbol, Bool, String}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:guidefonthalign, :guide_position, :mirror, :guide), Tuple{Symbol, Symbol, Bool, String}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:lims, :flip, :ticks, :guide), Tuple{Tuple{Int64, Int64}, Bool, StepRange{Int64, Int64}, String}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:lims,), Tuple{Tuple{Float64, Float64}}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:lims,), Tuple{Tuple{Int64, Float64}}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:lims,), Tuple{Tuple{Int64, Int64}}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:minorgrid, :scale, :guide), Tuple{Bool, Symbol, String}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:rotation,), Tuple{Int64}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:ticks,), Tuple{Nothing}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(attr!)),NamedTuple{(:ticks,), Tuple{UnitRange{Int64}}},typeof(attr!),Axis})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(default)),NamedTuple{(:shape,), Tuple{Symbol}},typeof(default)})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(default)),NamedTuple{(:titlefont, :legendfontsize, :guidefont, :tickfont, :guide, :framestyle, :yminorgrid), Tuple{Tuple{Int64, String}, Int64, Tuple{Int64, Symbol}, Tuple{Int64, Symbol}, String, Symbol, Bool}},typeof(default)})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(font)),NamedTuple{(:family, :pointsize, :halign, :valign, :rotation, :color), Tuple{String, Int64, Symbol, Symbol, Float64, RGBA{Float64}}},typeof(font)})
|
||||
@ -122,7 +117,6 @@ function _precompile_()
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:marker, :series_annotations, :seriestype), Tuple{Tuple{Int64, Float64, Symbol}, Vector{Any}, Symbol}},typeof(plot!),Plot{GRBackend},StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:marker, :series_annotations, :seriestype), Tuple{Tuple{Int64, Float64, Symbol}, Vector{Any}, Symbol}},typeof(plot!),Plot{PlotlyBackend},StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:marker, :series_annotations, :seriestype), Tuple{Tuple{Int64, Float64, Symbol}, Vector{Any}, Symbol}},typeof(plot!),StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:markersize, :c, :seriestype), Tuple{Int64, Symbol, Symbol}},typeof(plot!),Plot{GRBackend},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:markersize, :c, :seriestype), Tuple{Int64, Symbol, Symbol}},typeof(plot!),Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:seriestype, :inset), Tuple{Symbol, Tuple{Int64, BoundingBox{Tuple{Length{:w, Float64}, Length{:h, Float64}}, Tuple{Length{:w, Float64}, Length{:h, Float64}}}}}},typeof(plot!),Plot{GRBackend},Vector{Int64},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:seriestype, :inset), Tuple{Symbol, Tuple{Int64, BoundingBox{Tuple{Length{:w, Float64}, Length{:h, Float64}}, Tuple{Length{:w, Float64}, Length{:h, Float64}}}}}},typeof(plot!),Plot{PlotlyBackend},Vector{Int64},Vector{Float64}})
|
||||
@ -135,12 +129,12 @@ function _precompile_()
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:title,), Tuple{String}},typeof(plot!)})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:w,), Tuple{Int64}},typeof(plot!),Plot{GRBackend},Vector{Float64},Vector{Float64},Vararg{Any, N} where N})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:xgrid,), Tuple{Tuple{Symbol, Symbol, Int64, Symbol, Float64}}},typeof(plot!),Plot{GRBackend}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:yaxis, :minorgrid), Tuple{Tuple{String, Symbol}, Bool}},typeof(plot!),Plot{GRBackend}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:yaxis, :minorgrid), Tuple{Tuple{String, Symbol}, Bool}},typeof(plot!)})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:zcolor, :m, :ms, :lab, :seriestype), Tuple{Vector{Float64}, Tuple{Symbol, Float64, Stroke}, Vector{Float64}, String, Symbol}},typeof(plot!),Plot{GRBackend},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:zcolor, :m, :ms, :lab, :seriestype), Tuple{Vector{Float64}, Tuple{Symbol, Float64, Stroke}, Vector{Float64}, String, Symbol}},typeof(plot!),Plot{PlotlyBackend},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot!)),NamedTuple{(:zcolor, :m, :ms, :lab, :seriestype), Tuple{Vector{Float64}, Tuple{Symbol, Float64, Stroke}, Vector{Float64}, String, Symbol}},typeof(plot!),Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:annotations, :leg), Tuple{Tuple{Int64, Float64, PlotText}, Bool}},typeof(plot),Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:arrow,), Tuple{Int64}},typeof(plot),Vector{Float64},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:aspect_ratio, :seriestype), Tuple{Int64, Symbol}},typeof(plot),Vector{String},Vector{String},Matrix{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:bins, :weights, :seriestype), Tuple{Symbol, Vector{Int64}, Symbol}},typeof(plot),Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:color, :line, :marker), Tuple{Matrix{Symbol}, Tuple{Symbol, Int64}, Tuple{Matrix{Symbol}, Int64, Float64, Stroke}}},typeof(plot),Vector{Vector{T} where T}})
|
||||
@ -185,14 +179,12 @@ function _precompile_()
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:projection, :seriestype), Tuple{Symbol, Symbol}},typeof(plot),StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},UnitRange{Int64},Matrix{Int64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:quiver, :seriestype), Tuple{Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}}, Symbol}},typeof(plot),Vector{Float64},Vector{Float64},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:reg, :fill), Tuple{Bool, Tuple{Int64, Symbol}}},typeof(plot),Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:ribbon,), Tuple{Int64}},typeof(plot),UnitRange{Int64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:ribbon,), Tuple{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}}},typeof(plot),UnitRange{Int64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:ribbon,), Tuple{Tuple{LinRange{Float64}, LinRange{Float64}}}},typeof(plot),UnitRange{Int64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:ribbon,), Tuple{typeof(sqrt)}},typeof(plot),UnitRange{Int64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:seriestype, :markershape, :markersize, :color), Tuple{Matrix{Symbol}, Vector{Symbol}, Int64, Vector{Symbol}}},typeof(plot),Matrix{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:seriestype,), Tuple{Symbol}},typeof(plot),StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},Matrix{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:seriestype,), Tuple{Symbol}},typeof(plot),Vector{DateTime},UnitRange{Int64},Matrix{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:seriestype,), Tuple{Symbol}},typeof(plot),Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:seriestype,), Tuple{Symbol}},typeof(plot),Vector{OHLC}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:st, :xlabel, :ylabel, :zlabel), Tuple{Symbol, String, String, String}},typeof(plot),Vector{Float64},Vector{Float64},Vector{Float64}})
|
||||
Base.precompile(Tuple{Core.kwftype(typeof(plot)),NamedTuple{(:title, :l, :seriestype), Tuple{String, Float64, Symbol}},typeof(plot),Vector{String},Vector{Float64}})
|
||||
@ -211,7 +203,6 @@ function _precompile_()
|
||||
Base.precompile(Tuple{Type{GridLayout},Int64,Vararg{Int64, N} where N})
|
||||
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},AbstractVector{OHLC}})
|
||||
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},PortfolioComposition})
|
||||
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},Type{Val{:barbins}},Any,Any,Any})
|
||||
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},Type{Val{:barhist}},Any,Any,Any})
|
||||
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},Type{Val{:bar}},Any,Any,Any})
|
||||
Base.precompile(Tuple{typeof(RecipesBase.apply_recipe),AbstractDict{Symbol, Any},Type{Val{:bins2d}},Any,Any,Any})
|
||||
@ -230,7 +221,6 @@ function _precompile_()
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.plot_setup!),Plot{GRBackend},Dict{Symbol, Any},Vector{Dict{Symbol, Any}}})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.plot_setup!),Plot{PlotlyBackend},Dict{Symbol, Any},Vector{Dict{Symbol, Any}}})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.preprocess_attributes!),Plot{GRBackend},DefaultsDict})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.preprocess_axis_args!),Plot{GRBackend},Dict{Symbol, Any},Symbol})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.process_userrecipe!),Plot{GRBackend},Vector{Dict{Symbol, Any}},Dict{Symbol, Any}})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.process_userrecipe!),Plot{PlotlyBackend},Vector{Dict{Symbol, Any}},Dict{Symbol, Any}})
|
||||
Base.precompile(Tuple{typeof(RecipesPipeline.warn_on_recipe_aliases!),Plot{GRBackend},DefaultsDict,Symbol,Any})
|
||||
@ -243,14 +233,13 @@ function _precompile_()
|
||||
Base.precompile(Tuple{typeof(_cbar_unique),Vector{PlotUtils.ContinuousColorGradient},String})
|
||||
Base.precompile(Tuple{typeof(_cbar_unique),Vector{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}},String})
|
||||
Base.precompile(Tuple{typeof(_cbar_unique),Vector{Symbol},String})
|
||||
Base.precompile(Tuple{typeof(_cycle),StepRange{Int64, Int64},Vector{Int64}})
|
||||
Base.precompile(Tuple{typeof(_cycle),Vector{Float64},UnitRange{Int64}})
|
||||
Base.precompile(Tuple{typeof(_do_plot_show),Plot{GRBackend},Bool})
|
||||
Base.precompile(Tuple{typeof(_do_plot_show),Plot{PlotlyBackend},Bool})
|
||||
Base.precompile(Tuple{typeof(_heatmap_edges),Vector{Float64},Bool,Bool})
|
||||
Base.precompile(Tuple{typeof(_plot!),Plot,Any,Any})
|
||||
Base.precompile(Tuple{typeof(_preprocess_barlike),DefaultsDict,Base.OneTo{Int64},Vector{Float64}})
|
||||
Base.precompile(Tuple{typeof(_preprocess_binlike),DefaultsDict,StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},Vector{Float64}})
|
||||
Base.precompile(Tuple{typeof(_slice_series_args!),DefaultsDict,Plot{GRBackend},Subplot{GRBackend},Int64})
|
||||
Base.precompile(Tuple{typeof(_update_min_padding!),GridLayout})
|
||||
Base.precompile(Tuple{typeof(_update_subplot_args),Plot{GRBackend},Subplot{GRBackend},Dict{Symbol, Any},Int64,Bool})
|
||||
Base.precompile(Tuple{typeof(_update_subplot_args),Plot{PlotlyBackend},Subplot{PlotlyBackend},Dict{Symbol, Any},Int64,Bool})
|
||||
@ -264,18 +253,21 @@ function _precompile_()
|
||||
Base.precompile(Tuple{typeof(build_layout),GridLayout,Int64,Vector{Plot}})
|
||||
Base.precompile(Tuple{typeof(convert_to_polar),StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},Vector{Float64},Tuple{Int64, Float64}})
|
||||
Base.precompile(Tuple{typeof(create_grid),Expr})
|
||||
Base.precompile(Tuple{typeof(default),Symbol,String})
|
||||
Base.precompile(Tuple{typeof(error_coords),Vector{Float64},Vector{Float64},Vector{Float64},Vararg{Vector{Float64}, N} where N})
|
||||
Base.precompile(Tuple{typeof(error_coords),Vector{Float64},Vector{Float64},Vector{Float64}})
|
||||
Base.precompile(Tuple{typeof(error_zipit),Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}}})
|
||||
Base.precompile(Tuple{typeof(expand_extrema!),Axis,UnitRange{Int64}})
|
||||
Base.precompile(Tuple{typeof(fakedata),Int64,Int64})
|
||||
Base.precompile(Tuple{typeof(get_minor_ticks),Subplot{GRBackend},Axis,Tuple{Vector{Float64}, Vector{String}}})
|
||||
Base.precompile(Tuple{typeof(get_minor_ticks),Subplot{GRBackend},Axis,Tuple{Vector{Int64}, Vector{String}}})
|
||||
Base.precompile(Tuple{typeof(get_series_color),Vector{Symbol},Subplot{GRBackend},Int64,Symbol})
|
||||
Base.precompile(Tuple{typeof(get_series_color),PlotUtils.ContinuousColorGradient,Subplot{GRBackend},Int64,Symbol})
|
||||
Base.precompile(Tuple{typeof(get_ticks),StepRange{Int64, Int64},Vector{Float64},Vector{Any},Tuple{Int64, Int64},Vararg{Any, N} where N})
|
||||
Base.precompile(Tuple{typeof(get_ticks),Symbol,Vector{Float64},Vector{Any},Tuple{Float64, Float64},Vararg{Any, N} where N})
|
||||
Base.precompile(Tuple{typeof(get_ticks),Symbol,Vector{Float64},Vector{Any},Tuple{Int64, Float64},Vararg{Any, N} where N})
|
||||
Base.precompile(Tuple{typeof(get_ticks),Symbol,Vector{Float64},Vector{Any},Tuple{Int64, Int64},Vararg{Any, N} where N})
|
||||
Base.precompile(Tuple{typeof(get_ticks),UnitRange{Int64},Vector{Float64},Vector{Any},Tuple{Float64, Float64},Vararg{Any, N} where N})
|
||||
Base.precompile(Tuple{typeof(get_xy),OHLC{Float64},Int64,Float64})
|
||||
Base.precompile(Tuple{typeof(get_xy),Vector{OHLC}})
|
||||
Base.precompile(Tuple{typeof(gr_add_legend),Subplot{GRBackend},NamedTuple{(:w, :h, :dy, :leftw, :textw, :rightw, :xoffset, :yoffset, :width_factor), NTuple{9, Float64}},Vector{Float64}})
|
||||
Base.precompile(Tuple{typeof(gr_add_legend),Subplot{GRBackend},NamedTuple{(:w, :h, :dy, :leftw, :textw, :rightw, :xoffset, :yoffset, :width_factor), Tuple{Int64, Int64, Int64, Float64, Int64, Float64, Float64, Float64, Float64}},Vector{Float64}})
|
||||
@ -288,7 +280,9 @@ function _precompile_()
|
||||
Base.precompile(Tuple{typeof(gr_draw_marker),Series,Int64,Float64,Tuple{Float64, Float64},Int64,Float64,Int64,Symbol})
|
||||
Base.precompile(Tuple{typeof(gr_draw_marker),Series,Int64,Int64,Tuple{Float64, Float64},Int64,Int64,Int64,Symbol})
|
||||
Base.precompile(Tuple{typeof(gr_draw_markers),Series,Base.OneTo{Int64},Vector{Float64},Tuple{Float64, Float64}})
|
||||
Base.precompile(Tuple{typeof(gr_draw_markers),Series,Vector{Int64},Vector{Int64},Tuple{Float64, Float64},Int64,Int64})
|
||||
Base.precompile(Tuple{typeof(gr_draw_markers),Series,StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}},Vector{Float64},Tuple{Float64, Float64}})
|
||||
Base.precompile(Tuple{typeof(gr_draw_markers),Series,UnitRange{Int64},Vector{Float64},Tuple{Float64, Float64}})
|
||||
Base.precompile(Tuple{typeof(gr_draw_markers),Series,Vector{Int64},Vector{Float64},Tuple{Float64, Float64}})
|
||||
Base.precompile(Tuple{typeof(gr_draw_segments),Series,Base.OneTo{Int64},UnitRange{Int64},Tuple{Vector{Float64}, Vector{Float64}},Tuple{Float64, Float64}})
|
||||
Base.precompile(Tuple{typeof(gr_draw_segments),Series,Base.OneTo{Int64},Vector{Float64},Int64,Tuple{Float64, Float64}})
|
||||
Base.precompile(Tuple{typeof(gr_draw_segments),Series,StepRange{Int64, Int64},Vector{Float64},Int64,Tuple{Float64, Float64}})
|
||||
@ -298,7 +292,6 @@ function _precompile_()
|
||||
Base.precompile(Tuple{typeof(gr_draw_surface),Series,Vector{Float64},Vector{Float64},Vector{Float64},Tuple{Float64, Float64}})
|
||||
Base.precompile(Tuple{typeof(gr_fill_viewport),Vector{Float64},RGBA{Float64}})
|
||||
Base.precompile(Tuple{typeof(gr_get_ticks_size),Tuple{Vector{Float64}, Vector{String}},Int64})
|
||||
Base.precompile(Tuple{typeof(gr_get_ticks_size),Tuple{Vector{Int64}, Vector{String}},Int64})
|
||||
Base.precompile(Tuple{typeof(gr_label_ticks),Subplot{GRBackend},Symbol,Tuple{Vector{Float64}, Vector{String}}})
|
||||
Base.precompile(Tuple{typeof(gr_label_ticks_3d),Subplot{GRBackend},Symbol,Tuple{Vector{Float64}, Vector{String}}})
|
||||
Base.precompile(Tuple{typeof(gr_polaraxes),Int64,Float64,Subplot{GRBackend}})
|
||||
@ -314,7 +307,7 @@ function _precompile_()
|
||||
Base.precompile(Tuple{typeof(heatmap_edges),Vector{Float64},Symbol,Vector{Float64},Symbol,Tuple{Int64, Int64},Bool})
|
||||
Base.precompile(Tuple{typeof(heatmap_edges),Vector{Float64},Symbol})
|
||||
Base.precompile(Tuple{typeof(ignorenan_minimum),Vector{Int64}})
|
||||
Base.precompile(Tuple{typeof(make_fillrange_side),UnitRange{Int64},LinRange{Float64}})
|
||||
Base.precompile(Tuple{typeof(intersection_point),Float64,Float64,Float64,Float64,Float64,Float64})
|
||||
Base.precompile(Tuple{typeof(optimal_ticks_and_labels),Nothing,Tuple{Float64, Float64},Symbol,Function})
|
||||
Base.precompile(Tuple{typeof(optimal_ticks_and_labels),Nothing,Tuple{Float64, Float64},Symbol,Symbol})
|
||||
Base.precompile(Tuple{typeof(optimal_ticks_and_labels),Nothing,Tuple{Int64, Float64},Symbol,Symbol})
|
||||
@ -344,21 +337,25 @@ function _precompile_()
|
||||
Base.precompile(Tuple{typeof(process_annotation),Subplot{PlotlyBackend},Int64,Float64,Tuple{String, Symbol, Int64, String}})
|
||||
Base.precompile(Tuple{typeof(process_axis_arg!),Dict{Symbol, Any},StepRange{Int64, Int64},Symbol})
|
||||
Base.precompile(Tuple{typeof(process_axis_arg!),Dict{Symbol, Any},Symbol,Symbol})
|
||||
Base.precompile(Tuple{typeof(process_axis_arg!),Dict{Symbol, Any},Tuple{Int64, Int64},Symbol})
|
||||
Base.precompile(Tuple{typeof(push!),Plot{GRBackend},Float64,Vector{Float64}})
|
||||
Base.precompile(Tuple{typeof(resetfontsizes)})
|
||||
Base.precompile(Tuple{typeof(scalefontsizes),Float64})
|
||||
Base.precompile(Tuple{typeof(series_annotations),Vector{Any}})
|
||||
Base.precompile(Tuple{typeof(slice_arg),Base.ReshapedArray{Int64, 2, UnitRange{Int64}, Tuple{}},Int64})
|
||||
Base.precompile(Tuple{typeof(spy),Any})
|
||||
Base.precompile(Tuple{typeof(straightline_data),Tuple{Float64, Float64},Tuple{Float64, Float64},Vector{Float64},Vector{Float64},Int64})
|
||||
Base.precompile(Tuple{typeof(stroke),Int64,Vararg{Any, N} where N})
|
||||
Base.precompile(Tuple{typeof(title!),AbstractString})
|
||||
Base.precompile(Tuple{typeof(unzip),Vector{GeometryBasics.Point2{Float64}}})
|
||||
Base.precompile(Tuple{typeof(unzip),Vector{Tuple{Float64, Float64, Float64}}})
|
||||
Base.precompile(Tuple{typeof(unzip),Vector{Tuple{Float64, Float64}}})
|
||||
Base.precompile(Tuple{typeof(unzip),Vector{Tuple{Int64, Int64}}})
|
||||
Base.precompile(Tuple{typeof(unzip),Vector{Tuple{Vector{Float64}, Vector{Float64}}}})
|
||||
Base.precompile(Tuple{typeof(vline!),Any})
|
||||
Base.precompile(Tuple{typeof(xgrid!),Plot{GRBackend},Symbol,Vararg{Any, N} where N})
|
||||
Base.precompile(Tuple{typeof(xlims),Subplot{PlotlyBackend}})
|
||||
isdefined(Plots, Symbol("#add_major_or_minor_segments#126")) && Base.precompile(Tuple{getfield(Plots, Symbol("#add_major_or_minor_segments#126")),Vector{Float64},Bool,Segments{Tuple{Float64, Float64}},Float64,Bool})
|
||||
isdefined(Plots, Symbol("#add_major_or_minor_segments#127")) && Base.precompile(Tuple{getfield(Plots, Symbol("#add_major_or_minor_segments#127")),Vector{Float64},Bool,Segments{Tuple{Float64, Float64, Float64}},Float64,Bool})
|
||||
isdefined(Plots, Symbol("#add_major_or_minor_segments#120")) && Base.precompile(Tuple{getfield(Plots, Symbol("#add_major_or_minor_segments#120")),Vector{Float64},Bool,Segments{Tuple{Float64, Float64}},Float64,Bool})
|
||||
isdefined(Plots, Symbol("#add_major_or_minor_segments#121")) && Base.precompile(Tuple{getfield(Plots, Symbol("#add_major_or_minor_segments#121")),Vector{Float64},Bool,Segments{Tuple{Float64, Float64, Float64}},Float64,Bool})
|
||||
let fbody = try __lookup_kwbody__(which(font, (Font,Vararg{Any, N} where N,))) catch missing end
|
||||
if !ismissing(fbody)
|
||||
precompile(fbody, (Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}},typeof(font),Font,Vararg{Any, N} where N,))
|
||||
@ -389,4 +386,9 @@ function _precompile_()
|
||||
precompile(fbody, (Any,typeof(title!),AbstractString,))
|
||||
end
|
||||
end
|
||||
let fbody = try __lookup_kwbody__(which(vline!, (Any,))) catch missing end
|
||||
if !ismissing(fbody)
|
||||
precompile(fbody, (Any,typeof(vline!),Any,))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
243
src/args.jl
243
src/args.jl
@ -24,6 +24,14 @@ function add_aliases(sym::Symbol, aliases::Symbol...)
|
||||
return nothing
|
||||
end
|
||||
|
||||
function add_axes_aliases(sym::Symbol, aliases::Symbol...; generic::Bool = true)
|
||||
sym in keys(_axis_defaults) || throw(ArgumentError("Invalid `$sym`"))
|
||||
generic && add_aliases(sym, aliases...)
|
||||
for letter in (:x, :y, :z)
|
||||
add_aliases(Symbol(letter, sym), (Symbol(letter, a) for a in aliases)...)
|
||||
end
|
||||
end
|
||||
|
||||
function add_non_underscore_aliases!(aliases::Dict{Symbol,Symbol})
|
||||
for (k, v) in aliases
|
||||
s = string(k)
|
||||
@ -276,7 +284,7 @@ function hasgrid(arg::Symbol, letter)
|
||||
arg in (:all, :both, :on) || occursin(string(letter), string(arg))
|
||||
else
|
||||
@warn(
|
||||
"Unknown grid argument $arg; $(Symbol(letter, :grid)) was set to `true` instead."
|
||||
"Unknown grid argument $arg; $(get_attr_symbol(letter, :grid)) was set to `true` instead."
|
||||
)
|
||||
true
|
||||
end
|
||||
@ -316,7 +324,7 @@ function showaxis(arg::Symbol, letter)
|
||||
arg in (:all, :both, :on, :yes) || occursin(string(letter), string(arg))
|
||||
else
|
||||
@warn(
|
||||
"Unknown showaxis argument $arg; $(Symbol(letter, :showaxis)) was set to `true` instead."
|
||||
"Unknown showaxis argument $arg; $(get_attr_symbol(letter, :showaxis)) was set to `true` instead."
|
||||
)
|
||||
true
|
||||
end
|
||||
@ -571,11 +579,6 @@ function reset_axis_defaults_byletter!()
|
||||
end
|
||||
reset_axis_defaults_byletter!()
|
||||
|
||||
for letter in (:x, :y, :z), k in keys(_axis_defaults)
|
||||
# allow the underscore version too: xguide or x_guide
|
||||
add_aliases(Symbol(letter, k), Symbol(letter, "_", k))
|
||||
end
|
||||
|
||||
const _all_defaults = KW[_series_defaults, _plot_defaults, _subplot_defaults]
|
||||
|
||||
const _initial_defaults = deepcopy(_all_defaults)
|
||||
@ -620,6 +623,20 @@ const _all_subplot_args = sort(union([_subplot_args; _magic_subplot_args]))
|
||||
const _all_series_args = sort(union([_series_args; _magic_series_args]))
|
||||
const _all_plot_args = _plot_args
|
||||
|
||||
for letter in (:x, :y, :z)
|
||||
_attrsymbolcache[letter] = Dict{Symbol,Symbol}()
|
||||
for k in keys(_axis_defaults)
|
||||
# populate attribute cache
|
||||
lk = Symbol(letter, k)
|
||||
_attrsymbolcache[letter][k] = lk
|
||||
# allow the underscore version too: xguide or x_guide
|
||||
add_aliases(lk, Symbol(letter, "_", k))
|
||||
end
|
||||
for k in (_magic_axis_args..., :(_discrete_indices))
|
||||
_attrsymbolcache[letter][k] = Symbol(letter, k)
|
||||
end
|
||||
end
|
||||
|
||||
const _all_args =
|
||||
sort(union([_all_axis_args; _all_subplot_args; _all_series_args; _all_plot_args]))
|
||||
|
||||
@ -755,30 +772,7 @@ add_aliases(
|
||||
:fgcolour_subplot,
|
||||
:fg_colour_subplot,
|
||||
)
|
||||
add_aliases(
|
||||
:foreground_color_grid,
|
||||
:fg_grid,
|
||||
:fggrid,
|
||||
:fgcolor_grid,
|
||||
:fg_color_grid,
|
||||
:foreground_grid,
|
||||
:foreground_colour_grid,
|
||||
:fgcolour_grid,
|
||||
:fg_colour_grid,
|
||||
:gridcolor,
|
||||
)
|
||||
add_aliases(
|
||||
:foreground_color_minor_grid,
|
||||
:fg_minor_grid,
|
||||
:fgminorgrid,
|
||||
:fgcolor_minorgrid,
|
||||
:fg_color_minorgrid,
|
||||
:foreground_minorgrid,
|
||||
:foreground_colour_minor_grid,
|
||||
:fgcolour_minorgrid,
|
||||
:fg_colour_minor_grid,
|
||||
:minorgridcolor,
|
||||
)
|
||||
|
||||
add_aliases(
|
||||
:foreground_color_title,
|
||||
:fg_title,
|
||||
@ -846,7 +840,66 @@ add_aliases(:linealpha, :la, :lalpha, :lα, :lineopacity, :lopacity)
|
||||
add_aliases(:markeralpha, :ma, :malpha, :mα, :markeropacity, :mopacity)
|
||||
add_aliases(:markerstrokealpha, :msa, :msalpha, :msα, :markerstrokeopacity, :msopacity)
|
||||
add_aliases(:fillalpha, :fa, :falpha, :fα, :fillopacity, :fopacity)
|
||||
add_aliases(:gridalpha, :ga, :galpha, :gα, :gridopacity, :gopacity)
|
||||
|
||||
# axes attributes
|
||||
add_axes_aliases(:guide, :label, :lab, :l; generic = false)
|
||||
add_axes_aliases(:lims, :lim, :limit, :limits, :range)
|
||||
add_axes_aliases(:ticks, :tick)
|
||||
add_axes_aliases(:rotation, :rot, :r)
|
||||
add_axes_aliases(:guidefontsize, :labelfontsize)
|
||||
add_axes_aliases(:gridalpha, :ga, :galpha, :gα, :gridopacity, :gopacity)
|
||||
add_axes_aliases(:gridstyle, :grid_style, :gridlinestyle, :grid_linestyle, :grid_ls, :gridls)
|
||||
add_axes_aliases(
|
||||
:foreground_color_grid,
|
||||
:fg_grid,
|
||||
:fggrid,
|
||||
:fgcolor_grid,
|
||||
:fg_color_grid,
|
||||
:foreground_grid,
|
||||
:foreground_colour_grid,
|
||||
:fgcolour_grid,
|
||||
:fg_colour_grid,
|
||||
:gridcolor,
|
||||
)
|
||||
add_axes_aliases(
|
||||
:foreground_color_minor_grid,
|
||||
:fg_minor_grid,
|
||||
:fgminorgrid,
|
||||
:fgcolor_minorgrid,
|
||||
:fg_color_minorgrid,
|
||||
:foreground_minorgrid,
|
||||
:foreground_colour_minor_grid,
|
||||
:fgcolour_minorgrid,
|
||||
:fg_colour_minor_grid,
|
||||
:minorgridcolor,
|
||||
)
|
||||
add_axes_aliases(:gridlinewidth, :gridwidth, :grid_linewidth, :grid_width, :gridlw, :grid_lw)
|
||||
add_axes_aliases(
|
||||
:minorgridstyle,
|
||||
:minorgrid_style,
|
||||
:minorgridlinestyle,
|
||||
:minorgrid_linestyle,
|
||||
:minorgrid_ls,
|
||||
:minorgridls,
|
||||
)
|
||||
add_axes_aliases(
|
||||
:minorgridlinewidth,
|
||||
:minorgridwidth,
|
||||
:minorgrid_linewidth,
|
||||
:minorgrid_width,
|
||||
:minorgridlw,
|
||||
:minorgrid_lw,
|
||||
)
|
||||
add_axes_aliases(
|
||||
:tick_direction,
|
||||
:tickdirection,
|
||||
:tick_dir,
|
||||
:tickdir,
|
||||
:tick_orientation,
|
||||
:tickorientation,
|
||||
:tick_or,
|
||||
:tickor,
|
||||
)
|
||||
|
||||
# series attributes
|
||||
add_aliases(:seriestype, :st, :t, :typ, :linetype, :lt)
|
||||
@ -865,19 +918,7 @@ add_aliases(:group, :g, :grouping)
|
||||
add_aliases(:bins, :bin, :nbin, :nbins, :nb)
|
||||
add_aliases(:ribbon, :rib)
|
||||
add_aliases(:annotations, :ann, :anns, :annotate, :annotation)
|
||||
add_aliases(:xguide, :xlabel, :xlab, :xl)
|
||||
add_aliases(:xlims, :xlim, :xlimit, :xlimits, :xrange)
|
||||
add_aliases(:xticks, :xtick)
|
||||
add_aliases(:xrotation, :xrot, :xr)
|
||||
add_aliases(:yguide, :ylabel, :ylab, :yl)
|
||||
add_aliases(:ylims, :ylim, :ylimit, :ylimits, :yrange)
|
||||
add_aliases(:yticks, :ytick)
|
||||
add_aliases(:yrotation, :yrot, :yr)
|
||||
add_aliases(:zguide, :zlabel, :zlab, :zl)
|
||||
add_aliases(:zlims, :zlim, :zlimit, :zlimits)
|
||||
add_aliases(:zticks, :ztick)
|
||||
add_aliases(:zrotation, :zrot, :zr)
|
||||
add_aliases(:guidefontsize, :labelfontsize)
|
||||
|
||||
add_aliases(
|
||||
:fill_z,
|
||||
:fillz,
|
||||
@ -946,24 +987,7 @@ add_aliases(:html_output_format, :format, :fmt, :html_format)
|
||||
add_aliases(:orientation, :direction, :dir)
|
||||
add_aliases(:inset_subplots, :inset, :floating)
|
||||
add_aliases(:stride, :wirefame_stride, :surface_stride, :surf_str, :str)
|
||||
add_aliases(:gridlinewidth, :gridwidth, :grid_linewidth, :grid_width, :gridlw, :grid_lw)
|
||||
add_aliases(:gridstyle, :grid_style, :gridlinestyle, :grid_linestyle, :grid_ls, :gridls)
|
||||
add_aliases(
|
||||
:minorgridlinewidth,
|
||||
:minorgridwidth,
|
||||
:minorgrid_linewidth,
|
||||
:minorgrid_width,
|
||||
:minorgridlw,
|
||||
:minorgrid_lw,
|
||||
)
|
||||
add_aliases(
|
||||
:minorgridstyle,
|
||||
:minorgrid_style,
|
||||
:minorgridlinestyle,
|
||||
:minorgrid_linestyle,
|
||||
:minorgrid_ls,
|
||||
:minorgridls,
|
||||
)
|
||||
|
||||
add_aliases(
|
||||
:framestyle,
|
||||
:frame_style,
|
||||
@ -977,16 +1001,7 @@ add_aliases(
|
||||
:border_style,
|
||||
:border,
|
||||
)
|
||||
add_aliases(
|
||||
:tick_direction,
|
||||
:tickdirection,
|
||||
:tick_dir,
|
||||
:tickdir,
|
||||
:tick_orientation,
|
||||
:tickorientation,
|
||||
:tick_or,
|
||||
:tickor,
|
||||
)
|
||||
|
||||
add_aliases(:camera, :cam, :viewangle, :view_angle)
|
||||
add_aliases(:contour_labels, :contourlabels, :clabels, :clabs)
|
||||
add_aliases(:warn_on_unsupported, :warn)
|
||||
@ -1216,69 +1231,79 @@ end
|
||||
|
||||
function processGridArg!(plotattributes::AKW, arg, letter)
|
||||
if arg in _allGridArgs || isa(arg, Bool)
|
||||
plotattributes[Symbol(letter, :grid)] = hasgrid(arg, letter)
|
||||
plotattributes[get_attr_symbol(letter, :grid)] = hasgrid(arg, letter)
|
||||
|
||||
elseif allStyles(arg)
|
||||
plotattributes[Symbol(letter, :gridstyle)] = arg
|
||||
plotattributes[get_attr_symbol(letter, :gridstyle)] = arg
|
||||
|
||||
elseif typeof(arg) <: Stroke
|
||||
arg.width === nothing ||
|
||||
(plotattributes[Symbol(letter, :gridlinewidth)] = arg.width)
|
||||
(plotattributes[get_attr_symbol(letter, :gridlinewidth)] = arg.width)
|
||||
arg.color === nothing || (
|
||||
plotattributes[Symbol(letter, :foreground_color_grid)] =
|
||||
plotattributes[get_attr_symbol(letter, :foreground_color_grid)] =
|
||||
arg.color in (:auto, :match) ? :match : plot_color(arg.color)
|
||||
)
|
||||
arg.alpha === nothing || (plotattributes[Symbol(letter, :gridalpha)] = arg.alpha)
|
||||
arg.style === nothing || (plotattributes[Symbol(letter, :gridstyle)] = arg.style)
|
||||
arg.alpha === nothing ||
|
||||
(plotattributes[get_attr_symbol(letter, :gridalpha)] = arg.alpha)
|
||||
arg.style === nothing ||
|
||||
(plotattributes[get_attr_symbol(letter, :gridstyle)] = arg.style)
|
||||
|
||||
# linealpha
|
||||
elseif allAlphas(arg)
|
||||
plotattributes[Symbol(letter, :gridalpha)] = arg
|
||||
plotattributes[get_attr_symbol(letter, :gridalpha)] = arg
|
||||
|
||||
# linewidth
|
||||
elseif allReals(arg)
|
||||
plotattributes[Symbol(letter, :gridlinewidth)] = arg
|
||||
plotattributes[get_attr_symbol(letter, :gridlinewidth)] = arg
|
||||
|
||||
# color
|
||||
elseif !handleColors!(plotattributes, arg, Symbol(letter, :foreground_color_grid))
|
||||
elseif !handleColors!(
|
||||
plotattributes,
|
||||
arg,
|
||||
get_attr_symbol(letter, :foreground_color_grid),
|
||||
)
|
||||
@warn("Skipped grid arg $arg.")
|
||||
end
|
||||
end
|
||||
|
||||
function processMinorGridArg!(plotattributes::AKW, arg, letter)
|
||||
if arg in _allGridArgs || isa(arg, Bool)
|
||||
plotattributes[Symbol(letter, :minorgrid)] = hasgrid(arg, letter)
|
||||
plotattributes[get_attr_symbol(letter, :minorgrid)] = hasgrid(arg, letter)
|
||||
|
||||
elseif allStyles(arg)
|
||||
plotattributes[Symbol(letter, :minorgridstyle)] = arg
|
||||
plotattributes[Symbol(letter, :minorgrid)] = true
|
||||
plotattributes[get_attr_symbol(letter, :minorgridstyle)] = arg
|
||||
plotattributes[get_attr_symbol(letter, :minorgrid)] = true
|
||||
|
||||
elseif typeof(arg) <: Stroke
|
||||
arg.width === nothing ||
|
||||
(plotattributes[Symbol(letter, :minorgridlinewidth)] = arg.width)
|
||||
(plotattributes[get_attr_symbol(letter, :minorgridlinewidth)] = arg.width)
|
||||
arg.color === nothing || (
|
||||
plotattributes[Symbol(letter, :foreground_color_minor_grid)] =
|
||||
plotattributes[get_attr_symbol(letter, :foreground_color_minor_grid)] =
|
||||
arg.color in (:auto, :match) ? :match : plot_color(arg.color)
|
||||
)
|
||||
arg.alpha === nothing ||
|
||||
(plotattributes[Symbol(letter, :minorgridalpha)] = arg.alpha)
|
||||
(plotattributes[get_attr_symbol(letter, :minorgridalpha)] = arg.alpha)
|
||||
arg.style === nothing ||
|
||||
(plotattributes[Symbol(letter, :minorgridstyle)] = arg.style)
|
||||
plotattributes[Symbol(letter, :minorgrid)] = true
|
||||
(plotattributes[get_attr_symbol(letter, :minorgridstyle)] = arg.style)
|
||||
plotattributes[get_attr_symbol(letter, :minorgrid)] = true
|
||||
|
||||
# linealpha
|
||||
elseif allAlphas(arg)
|
||||
plotattributes[Symbol(letter, :minorgridalpha)] = arg
|
||||
plotattributes[Symbol(letter, :minorgrid)] = true
|
||||
plotattributes[get_attr_symbol(letter, :minorgridalpha)] = arg
|
||||
plotattributes[get_attr_symbol(letter, :minorgrid)] = true
|
||||
|
||||
# linewidth
|
||||
elseif allReals(arg)
|
||||
plotattributes[Symbol(letter, :minorgridlinewidth)] = arg
|
||||
plotattributes[Symbol(letter, :minorgrid)] = true
|
||||
plotattributes[get_attr_symbol(letter, :minorgridlinewidth)] = arg
|
||||
plotattributes[get_attr_symbol(letter, :minorgrid)] = true
|
||||
|
||||
# color
|
||||
elseif handleColors!(plotattributes, arg, Symbol(letter, :foreground_color_minor_grid))
|
||||
plotattributes[Symbol(letter, :minorgrid)] = true
|
||||
elseif handleColors!(
|
||||
plotattributes,
|
||||
arg,
|
||||
get_attr_symbol(letter, :foreground_color_minor_grid),
|
||||
)
|
||||
plotattributes[get_attr_symbol(letter, :minorgrid)] = true
|
||||
else
|
||||
@warn("Skipped grid arg $arg.")
|
||||
end
|
||||
@ -1344,7 +1369,7 @@ function RecipesPipeline.preprocess_attributes!(plotattributes::AKW)
|
||||
end
|
||||
# handle axis args
|
||||
for letter in (:x, :y, :z)
|
||||
asym = Symbol(letter, :axis)
|
||||
asym = get_attr_symbol(letter, :axis)
|
||||
args = RecipesPipeline.pop_kw!(plotattributes, asym, ())
|
||||
if !(typeof(args) <: Axis)
|
||||
for arg in wraptuple(args)
|
||||
@ -1371,7 +1396,7 @@ function RecipesPipeline.preprocess_attributes!(plotattributes::AKW)
|
||||
end
|
||||
# handle individual axes grid args
|
||||
for letter in (:x, :y, :z)
|
||||
gridsym = Symbol(letter, :grid)
|
||||
gridsym = get_attr_symbol(letter, :grid)
|
||||
args = RecipesPipeline.pop_kw!(plotattributes, gridsym, ())
|
||||
for arg in wraptuple(args)
|
||||
processGridArg!(plotattributes, arg, letter)
|
||||
@ -1386,7 +1411,7 @@ function RecipesPipeline.preprocess_attributes!(plotattributes::AKW)
|
||||
end
|
||||
# handle individual axes grid args
|
||||
for letter in (:x, :y, :z)
|
||||
gridsym = Symbol(letter, :minorgrid)
|
||||
gridsym = get_attr_symbol(letter, :minorgrid)
|
||||
args = RecipesPipeline.pop_kw!(plotattributes, gridsym, ())
|
||||
for arg in wraptuple(args)
|
||||
processMinorGridArg!(plotattributes, arg, letter)
|
||||
@ -1397,16 +1422,20 @@ function RecipesPipeline.preprocess_attributes!(plotattributes::AKW)
|
||||
args = RecipesPipeline.pop_kw!(plotattributes, fontname, ())
|
||||
for arg in wraptuple(args)
|
||||
for letter in (:x, :y, :z)
|
||||
processFontArg!(plotattributes, Symbol(letter, fontname), arg)
|
||||
processFontArg!(plotattributes, get_attr_symbol(letter, fontname), arg)
|
||||
end
|
||||
end
|
||||
end
|
||||
# handle individual axes font args
|
||||
for letter in (:x, :y, :z)
|
||||
for fontname in (:tickfont, :guidefont)
|
||||
args = RecipesPipeline.pop_kw!(plotattributes, Symbol(letter, fontname), ())
|
||||
args = RecipesPipeline.pop_kw!(
|
||||
plotattributes,
|
||||
get_attr_symbol(letter, fontname),
|
||||
(),
|
||||
)
|
||||
for arg in wraptuple(args)
|
||||
processFontArg!(plotattributes, Symbol(letter, fontname), arg)
|
||||
processFontArg!(plotattributes, get_attr_symbol(letter, fontname), arg)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1415,7 +1444,7 @@ function RecipesPipeline.preprocess_attributes!(plotattributes::AKW)
|
||||
if haskey(plotattributes, k) && k !== :link
|
||||
v = plotattributes[k]
|
||||
for letter in (:x, :y, :z)
|
||||
lk = Symbol(letter, k)
|
||||
lk = get_attr_symbol(letter, k)
|
||||
if !is_explicit(plotattributes, lk)
|
||||
plotattributes[lk] = v
|
||||
end
|
||||
@ -1541,8 +1570,7 @@ function warn_on_unsupported_args(pkg::AbstractBackend, plotattributes)
|
||||
end
|
||||
end
|
||||
|
||||
if !isempty(_to_warn) &&
|
||||
!get(plotattributes, :warn_on_unsupported, _plot_defaults[:warn_on_unsupported])
|
||||
if !isempty(_to_warn) && get(plotattributes, :warn_on_unsupported, _plot_defaults[:warn_on_unsupported])
|
||||
for k in sort(collect(_to_warn))
|
||||
push!(already_warned, k)
|
||||
@warn(
|
||||
@ -1922,7 +1950,8 @@ function _update_axis(
|
||||
end
|
||||
|
||||
# then get those args that were passed with a leading letter: `xlabel = "X"`
|
||||
lk = Symbol(letter, k)
|
||||
lk = get_attr_symbol(letter, k)
|
||||
|
||||
if haskey(plotattributes_in, lk)
|
||||
kw[k] = slice_arg(plotattributes_in[lk], subplot_index)
|
||||
end
|
||||
@ -1979,7 +2008,7 @@ function _update_subplot_args(
|
||||
lims_warned = false
|
||||
for letter in (:x, :y, :z)
|
||||
_update_axis(plt, sp, plotattributes_in, letter, subplot_index)
|
||||
lk = Symbol(letter, :lims)
|
||||
lk = get_attr_symbol(letter, :lims)
|
||||
|
||||
# warn against using `Range` in x,y,z lims
|
||||
if !lims_warned &&
|
||||
|
||||
59
src/axes.jl
59
src/axes.jl
@ -23,7 +23,7 @@ function Axis(sp::Subplot, letter::Symbol, args...; kw...)
|
||||
end
|
||||
|
||||
function get_axis(sp::Subplot, letter::Symbol)
|
||||
axissym = Symbol(letter, :axis)
|
||||
axissym = get_attr_symbol(letter, :axis)
|
||||
if haskey(sp.attr, axissym)
|
||||
sp.attr[axissym]
|
||||
else
|
||||
@ -35,40 +35,44 @@ function process_axis_arg!(plotattributes::AKW, arg, letter = "")
|
||||
T = typeof(arg)
|
||||
arg = get(_scaleAliases, arg, arg)
|
||||
if typeof(arg) <: Font
|
||||
plotattributes[Symbol(letter, :tickfont)] = arg
|
||||
plotattributes[Symbol(letter, :guidefont)] = arg
|
||||
plotattributes[get_attr_symbol(letter, :tickfont)] = arg
|
||||
plotattributes[get_attr_symbol(letter, :guidefont)] = arg
|
||||
|
||||
elseif arg in _allScales
|
||||
plotattributes[Symbol(letter, :scale)] = arg
|
||||
plotattributes[get_attr_symbol(letter, :scale)] = arg
|
||||
|
||||
elseif arg in (:flip, :invert, :inverted)
|
||||
plotattributes[Symbol(letter, :flip)] = true
|
||||
plotattributes[get_attr_symbol(letter, :flip)] = true
|
||||
|
||||
elseif T <: AbstractString
|
||||
plotattributes[Symbol(letter, :guide)] = arg
|
||||
plotattributes[get_attr_symbol(letter, :guide)] = arg
|
||||
|
||||
# xlims/ylims
|
||||
elseif (T <: Tuple || T <: AVec) && length(arg) == 2
|
||||
sym = typeof(arg[1]) <: Number ? :lims : :ticks
|
||||
plotattributes[Symbol(letter, sym)] = arg
|
||||
plotattributes[get_attr_symbol(letter, sym)] = arg
|
||||
|
||||
# xticks/yticks
|
||||
elseif T <: AVec
|
||||
plotattributes[Symbol(letter, :ticks)] = arg
|
||||
plotattributes[get_attr_symbol(letter, :ticks)] = arg
|
||||
|
||||
elseif arg === nothing
|
||||
plotattributes[Symbol(letter, :ticks)] = []
|
||||
plotattributes[get_attr_symbol(letter, :ticks)] = []
|
||||
|
||||
elseif T <: Bool || arg in _allShowaxisArgs
|
||||
plotattributes[Symbol(letter, :showaxis)] = showaxis(arg, letter)
|
||||
plotattributes[get_attr_symbol(letter, :showaxis)] = showaxis(arg, letter)
|
||||
|
||||
elseif typeof(arg) <: Number
|
||||
plotattributes[Symbol(letter, :rotation)] = arg
|
||||
plotattributes[get_attr_symbol(letter, :rotation)] = arg
|
||||
|
||||
elseif typeof(arg) <: Function
|
||||
plotattributes[Symbol(letter, :formatter)] = arg
|
||||
plotattributes[get_attr_symbol(letter, :formatter)] = arg
|
||||
|
||||
elseif !handleColors!(plotattributes, arg, Symbol(letter, :foreground_color_axis))
|
||||
elseif !handleColors!(
|
||||
plotattributes,
|
||||
arg,
|
||||
get_attr_symbol(letter, :foreground_color_axis),
|
||||
)
|
||||
@warn("Skipped $(letter)axis arg $arg")
|
||||
end
|
||||
end
|
||||
@ -297,7 +301,7 @@ for l in (:x, :y, :z)
|
||||
end
|
||||
end
|
||||
# get_ticks from axis symbol :x, :y, or :z
|
||||
get_ticks(sp::Subplot, s::Symbol) = get_ticks(sp, sp[Symbol(s, :axis)])
|
||||
get_ticks(sp::Subplot, s::Symbol) = get_ticks(sp, sp[get_attr_symbol(s, :axis)])
|
||||
get_ticks(p::Plot, s::Symbol) = [get_ticks(sp, s) for sp in p.subplots]
|
||||
|
||||
function get_ticks(ticks::Symbol, cvals::T, dvals, args...) where {T}
|
||||
@ -393,7 +397,7 @@ end
|
||||
|
||||
function reset_extrema!(sp::Subplot)
|
||||
for asym in (:x, :y, :z)
|
||||
sp[Symbol(asym, :axis)][:extrema] = Extrema()
|
||||
sp[get_attr_symbol(asym, :axis)][:extrema] = Extrema()
|
||||
end
|
||||
for series in sp.series_list
|
||||
expand_extrema!(sp, series.plotattributes)
|
||||
@ -446,7 +450,7 @@ function expand_extrema!(sp::Subplot, plotattributes::AKW)
|
||||
)
|
||||
data = [NaN]
|
||||
end
|
||||
axis = sp[Symbol(letter, "axis")]
|
||||
axis = sp[get_attr_symbol(letter, :axis)]
|
||||
|
||||
if isa(data, Volume)
|
||||
expand_extrema!(sp[:xaxis], data.x_extents)
|
||||
@ -463,7 +467,8 @@ function expand_extrema!(sp::Subplot, plotattributes::AKW)
|
||||
# TODO: need more here... gotta track the discrete reference value
|
||||
# as well as any coord offset (think of boxplot shape coords... they all
|
||||
# correspond to the same x-value)
|
||||
plotattributes[letter], plotattributes[Symbol(letter, "_discrete_indices")] =
|
||||
plotattributes[letter],
|
||||
plotattributes[get_attr_symbol(letter, :(_discrete_indices))] =
|
||||
discrete_value!(axis, data)
|
||||
expand_extrema!(axis, plotattributes[letter])
|
||||
end
|
||||
@ -502,7 +507,7 @@ function expand_extrema!(sp::Subplot, plotattributes::AKW)
|
||||
plotattributes[:bar_width] =
|
||||
_bar_width * ignorenan_minimum(filter(x -> x > 0, diff(sort(data))))
|
||||
end
|
||||
axis = sp.attr[Symbol(dsym, :axis)]
|
||||
axis = sp.attr[get_attr_symbol(dsym, :axis)]
|
||||
expand_extrema!(axis, ignorenan_maximum(data) + 0.5maximum(bw))
|
||||
expand_extrema!(axis, ignorenan_minimum(data) - 0.5minimum(bw))
|
||||
end
|
||||
@ -511,8 +516,8 @@ function expand_extrema!(sp::Subplot, plotattributes::AKW)
|
||||
if plotattributes[:seriestype] == :heatmap
|
||||
for letter in (:x, :y)
|
||||
data = plotattributes[letter]
|
||||
axis = sp[Symbol(letter, "axis")]
|
||||
scale = get(plotattributes, Symbol(letter, "scale"), :identity)
|
||||
axis = sp[get_attr_symbol(letter, :axis)]
|
||||
scale = get(plotattributes, get_attr_symbol(letter, :scale), :identity)
|
||||
expand_extrema!(axis, heatmap_edges(data, scale))
|
||||
end
|
||||
end
|
||||
@ -586,10 +591,10 @@ end
|
||||
function axis_limits(
|
||||
sp,
|
||||
letter,
|
||||
should_widen = default_should_widen(sp[Symbol(letter, :axis)]),
|
||||
should_widen = default_should_widen(sp[get_attr_symbol(letter, :axis)]),
|
||||
consider_aspect = true,
|
||||
)
|
||||
axis = sp[Symbol(letter, :axis)]
|
||||
axis = sp[get_attr_symbol(letter, :axis)]
|
||||
ex = axis[:extrema]
|
||||
amin, amax = ex.emin, ex.emax
|
||||
lims = axis[:lims]
|
||||
@ -724,10 +729,10 @@ end
|
||||
# compute the line segments which should be drawn for this axis
|
||||
function axis_drawing_info(sp, letter)
|
||||
# find out which axis we are dealing with
|
||||
asym = Symbol(letter, :axis)
|
||||
asym = get_attr_symbol(letter, :axis)
|
||||
isy = letter === :y
|
||||
oletter = isy ? :x : :y
|
||||
oasym = Symbol(oletter, :axis)
|
||||
oasym = get_attr_symbol(oletter, :axis)
|
||||
|
||||
# get axis objects, ticks and minor ticks
|
||||
ax, oax = sp[asym], sp[oasym]
|
||||
@ -856,9 +861,9 @@ function axis_drawing_info_3d(sp, letter)
|
||||
near_letter = letter in (:x, :z) ? :y : :x
|
||||
far_letter = letter in (:x, :y) ? :z : :x
|
||||
|
||||
ax = sp[Symbol(letter, :axis)]
|
||||
nax = sp[Symbol(near_letter, :axis)]
|
||||
fax = sp[Symbol(far_letter, :axis)]
|
||||
ax = sp[get_attr_symbol(letter, :axis)]
|
||||
nax = sp[get_attr_symbol(near_letter, :axis)]
|
||||
fax = sp[get_attr_symbol(far_letter, :axis)]
|
||||
|
||||
amin, amax = axis_limits(sp, letter)
|
||||
namin, namax = axis_limits(sp, near_letter)
|
||||
|
||||
@ -247,7 +247,7 @@ function merge_with_base_supported(v::AVec)
|
||||
for vi in v
|
||||
if haskey(_axis_defaults, vi)
|
||||
for letter in (:x, :y, :z)
|
||||
push!(v, Symbol(letter, vi))
|
||||
push!(v, get_attr_symbol(letter, vi))
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -910,16 +910,22 @@ const _gaston_scale = [:identity, :ln, :log2, :log10]
|
||||
# unicodeplots
|
||||
|
||||
const _unicodeplots_attr = merge_with_base_supported([
|
||||
:annotations,
|
||||
:bins,
|
||||
:guide,
|
||||
# :grid,
|
||||
:label,
|
||||
:layout,
|
||||
:legend,
|
||||
:seriescolor,
|
||||
:seriesalpha,
|
||||
:lims,
|
||||
:linealpha,
|
||||
:linecolor,
|
||||
:linestyle,
|
||||
:markershape,
|
||||
:bins,
|
||||
:seriesalpha,
|
||||
:seriescolor,
|
||||
:scale,
|
||||
:title,
|
||||
:guide,
|
||||
:lims,
|
||||
])
|
||||
const _unicodeplots_seriestype = [
|
||||
:path,
|
||||
@ -933,7 +939,7 @@ const _unicodeplots_seriestype = [
|
||||
]
|
||||
const _unicodeplots_style = [:auto, :solid]
|
||||
const _unicodeplots_marker = [:none, :auto, :circle]
|
||||
const _unicodeplots_scale = [:identity]
|
||||
const _unicodeplots_scale = [:identity, :ln, :log2, :log10]
|
||||
|
||||
# Additional constants
|
||||
const _canvas_type = Ref(:auto)
|
||||
|
||||
@ -331,7 +331,7 @@ end
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
function pgf_axis(sp::Subplot, letter)
|
||||
axis = sp[Symbol(letter, :axis)]
|
||||
axis = sp[get_attr_symbol(letter, :axis)]
|
||||
style = []
|
||||
kw = KW()
|
||||
|
||||
@ -342,7 +342,7 @@ function pgf_axis(sp::Subplot, letter)
|
||||
framestyle = pgf_framestyle(sp[:framestyle])
|
||||
|
||||
# axis guide
|
||||
kw[Symbol(letter, :label)] = axis[:guide]
|
||||
kw[get_attr_symbol(letter, :label)] = axis[:guide]
|
||||
|
||||
# axis label position
|
||||
labelpos = ""
|
||||
@ -378,7 +378,7 @@ function pgf_axis(sp::Subplot, letter)
|
||||
# scale
|
||||
scale = axis[:scale]
|
||||
if scale in (:log2, :ln, :log10)
|
||||
kw[Symbol(letter, :mode)] = "log"
|
||||
kw[get_attr_symbol(letter, :mode)] = "log"
|
||||
scale == :ln || push!(style, "log basis $letter=$(scale == :log2 ? 2 : 10)")
|
||||
end
|
||||
|
||||
@ -400,8 +400,8 @@ function pgf_axis(sp::Subplot, letter)
|
||||
lims =
|
||||
ispolar(sp) && letter == :x ? rad2deg.(axis_limits(sp, :x)) :
|
||||
axis_limits(sp, letter)
|
||||
kw[Symbol(letter, :min)] = lims[1]
|
||||
kw[Symbol(letter, :max)] = lims[2]
|
||||
kw[get_attr_symbol(letter, :min)] = lims[1]
|
||||
kw[get_attr_symbol(letter, :max)] = lims[2]
|
||||
end
|
||||
|
||||
if !(axis[:ticks] in (nothing, false, :none, :native)) && framestyle != :none
|
||||
|
||||
@ -372,7 +372,7 @@ function gaston_parse_axes_args(
|
||||
|
||||
for letter in (:x, :y, :z)
|
||||
(letter == :z && dims == 2) && continue
|
||||
axis = sp.attr[Symbol(letter, :axis)]
|
||||
axis = sp.attr[get_attr_symbol(letter, :axis)]
|
||||
# label names
|
||||
push!(
|
||||
axesconf,
|
||||
|
||||
@ -670,7 +670,7 @@ function gr_display(plt::Plot, fmt = "")
|
||||
end
|
||||
|
||||
function gr_set_tickfont(sp, letter)
|
||||
axis = sp[Symbol(letter, :axis)]
|
||||
axis = sp[get_attr_symbol(letter, :axis)]
|
||||
|
||||
mirror = (
|
||||
vcenter = :vcenter,
|
||||
@ -746,8 +746,8 @@ function gr_get_ticks_size(ticks, rot)
|
||||
w, h = 0.0, 0.0
|
||||
for (cv, dv) in zip(ticks...)
|
||||
wi, hi = gr_text_size(dv, rot)
|
||||
w = max(w, wi)
|
||||
h = max(h, hi)
|
||||
w = NaNMath.max(w, wi)
|
||||
h = NaNMath.max(h, hi)
|
||||
end
|
||||
return w, h
|
||||
end
|
||||
@ -1478,7 +1478,7 @@ end
|
||||
|
||||
function gr_draw_axis(sp, letter, viewport_plotarea)
|
||||
ax = axis_drawing_info(sp, letter)
|
||||
axis = sp[Symbol(letter, :axis)]
|
||||
axis = sp[get_attr_symbol(letter, :axis)]
|
||||
|
||||
# draw segments
|
||||
gr_draw_grid(sp, axis, ax.grid_segments)
|
||||
@ -1494,7 +1494,7 @@ end
|
||||
|
||||
function gr_draw_axis_3d(sp, letter, viewport_plotarea)
|
||||
ax = axis_drawing_info_3d(sp, letter)
|
||||
axis = sp[Symbol(letter, :axis)]
|
||||
axis = sp[get_attr_symbol(letter, :axis)]
|
||||
|
||||
# draw segments
|
||||
gr_draw_grid(sp, axis, ax.grid_segments, gr_polyline3d)
|
||||
@ -1575,10 +1575,10 @@ function gr_draw_ticks(sp, axis, segments, func = gr_polyline)
|
||||
end
|
||||
|
||||
function gr_label_ticks(sp, letter, ticks)
|
||||
axis = sp[Symbol(letter, :axis)]
|
||||
axis = sp[get_attr_symbol(letter, :axis)]
|
||||
isy = letter === :y
|
||||
oletter = isy ? :x : :y
|
||||
oaxis = sp[Symbol(oletter, :axis)]
|
||||
oaxis = sp[get_attr_symbol(oletter, :axis)]
|
||||
oamin, oamax = axis_limits(sp, oletter)
|
||||
gr_set_tickfont(sp, letter)
|
||||
out_factor = ifelse(axis[:tick_direction] === :out, 1.5, 1)
|
||||
@ -1611,9 +1611,9 @@ function gr_label_ticks_3d(sp, letter, ticks)
|
||||
near_letter = letter in (:x, :z) ? :y : :x
|
||||
far_letter = letter in (:x, :y) ? :z : :x
|
||||
|
||||
ax = sp[Symbol(letter, :axis)]
|
||||
nax = sp[Symbol(near_letter, :axis)]
|
||||
fax = sp[Symbol(far_letter, :axis)]
|
||||
ax = sp[get_attr_symbol(letter, :axis)]
|
||||
nax = sp[get_attr_symbol(near_letter, :axis)]
|
||||
fax = sp[get_attr_symbol(far_letter, :axis)]
|
||||
|
||||
amin, amax = axis_limits(sp, letter)
|
||||
namin, namax = axis_limits(sp, near_letter)
|
||||
@ -1623,7 +1623,7 @@ function gr_label_ticks_3d(sp, letter, ticks)
|
||||
# find out which axes we are dealing with
|
||||
i = findfirst(==(letter), (:x, :y, :z))
|
||||
letters = axes_shift((:x, :y, :z), 1 - i)
|
||||
asyms = Symbol.(letters, :axis)
|
||||
asyms = get_attr_symbol.(letters, :axis)
|
||||
|
||||
# get axis objects, ticks and minor ticks
|
||||
# regardless of the `letter` we now use the convention that `x` in variable names refer to
|
||||
@ -1660,7 +1660,7 @@ function gr_label_ticks_3d(sp, letter, ticks)
|
||||
end
|
||||
|
||||
function gr_label_axis(sp, letter, viewport_plotarea)
|
||||
axis = sp[Symbol(letter, :axis)]
|
||||
axis = sp[get_attr_symbol(letter, :axis)]
|
||||
mirror = axis[:mirror]
|
||||
# guide
|
||||
if axis[:guide] != ""
|
||||
@ -1704,13 +1704,13 @@ function gr_label_axis(sp, letter, viewport_plotarea)
|
||||
end
|
||||
|
||||
function gr_label_axis_3d(sp, letter)
|
||||
ax = sp[Symbol(letter, :axis)]
|
||||
ax = sp[get_attr_symbol(letter, :axis)]
|
||||
if ax[:guide] != ""
|
||||
near_letter = letter in (:x, :z) ? :y : :x
|
||||
far_letter = letter in (:x, :y) ? :z : :x
|
||||
|
||||
nax = sp[Symbol(near_letter, :axis)]
|
||||
fax = sp[Symbol(far_letter, :axis)]
|
||||
nax = sp[get_attr_symbol(near_letter, :axis)]
|
||||
fax = sp[get_attr_symbol(far_letter, :axis)]
|
||||
|
||||
amin, amax = axis_limits(sp, letter)
|
||||
namin, namax = axis_limits(sp, near_letter)
|
||||
|
||||
@ -1200,7 +1200,7 @@ function pgfx_sanitize_plot!(plt)
|
||||
end
|
||||
# --------------------------------------------------------------------------------------
|
||||
function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
|
||||
axis = sp[Symbol(letter, :axis)]
|
||||
axis = sp[get_attr_symbol(letter, :axis)]
|
||||
|
||||
# turn off scaled ticks
|
||||
push!(opt, "scaled $(letter) ticks" => "false", string(letter, :label) => axis[:guide])
|
||||
|
||||
@ -499,7 +499,7 @@ function plotly_close_shapes(x, y)
|
||||
end
|
||||
|
||||
function plotly_data(series::Series, letter::Symbol, data)
|
||||
axis = series[:subplot][Symbol(letter, :axis)]
|
||||
axis = series[:subplot][get_attr_symbol(letter, :axis)]
|
||||
|
||||
data = if axis[:ticks] == :native && data !== nothing
|
||||
plotly_native_data(axis, data)
|
||||
|
||||
@ -24,11 +24,30 @@ pycollections = PyPlot.pyimport("matplotlib.collections")
|
||||
pyart3d = PyPlot.art3D
|
||||
pyrcparams = PyPlot.PyDict(PyPlot.matplotlib."rcParams")
|
||||
|
||||
# "support" matplotlib v1.5
|
||||
# "support" matplotlib v3.4
|
||||
if PyPlot.version < v"3.4"
|
||||
@warn("""You are using Matplotlib $(PyPlot.version), which is no longer
|
||||
officialy supported by the Plots community. To ensure smooth Plots.jl
|
||||
integration update your Matplotlib library to a version >= 3.4.0
|
||||
|
||||
If you have used Conda.jl to install PyPlot (default installation),
|
||||
upgrade your matplotlib via Conda.jl and rebuild the PyPlot.
|
||||
|
||||
If you are not sure, here are the default instructions:
|
||||
|
||||
In Julia REPL:
|
||||
```
|
||||
import Pkg;
|
||||
Pkg.add("Conda")
|
||||
import Conda
|
||||
Conda.update()
|
||||
Pkg.build("PyPlot")
|
||||
```
|
||||
|
||||
""")
|
||||
end
|
||||
|
||||
set_facecolor_sym = if PyPlot.version < v"2"
|
||||
@warn(
|
||||
"You are using Matplotlib $(PyPlot.version), which is no longer officialy supported by the Plots community. To ensure smooth Plots.jl integration update your Matplotlib library to a version >= 2.0.0"
|
||||
)
|
||||
:set_axis_bgcolor
|
||||
else
|
||||
:set_facecolor
|
||||
@ -60,6 +79,14 @@ end
|
||||
# # anything else just gets a bluesred gradient
|
||||
# py_colormap(c, α=nothing) = py_colormap(default_gradient(), α)
|
||||
|
||||
for k in (:linthresh, :base, :label)
|
||||
# add PyPlot specific symbols to cache
|
||||
_attrsymbolcache[k] = Dict{Symbol,Symbol}()
|
||||
for letter in (:x, :y, :z, Symbol(""), :top, :bottom, :left, :right)
|
||||
_attrsymbolcache[k][letter] = Symbol(k, letter)
|
||||
end
|
||||
end
|
||||
|
||||
py_handle_surface(v) = v
|
||||
py_handle_surface(z::Surface) = z.surf
|
||||
|
||||
@ -165,6 +192,22 @@ end
|
||||
py_fillstyle(::Nothing) = nothing
|
||||
py_fillstyle(fillstyle::Symbol) = string(fillstyle)
|
||||
|
||||
function py_get_matching_math_font(parent_fontfamily)
|
||||
# matplotlib supported math fonts according to
|
||||
# https://matplotlib.org/stable/tutorials/text/mathtext.html
|
||||
py_math_supported_fonts = Dict{String,String}(
|
||||
"sans-serif" => "dejavusans",
|
||||
"serif" => "dejavuserif",
|
||||
"cm" => "cm",
|
||||
"stix" => "stix",
|
||||
"stixsans" => "stixsans",
|
||||
)
|
||||
# Fallback to "dejavusans" or "dejavuserif" in case the parentfont is different
|
||||
# from supported by matplotlib fonts
|
||||
matching_font(font) = occursin("serif", lowercase(font)) ? "dejavuserif" : "dejavusans"
|
||||
return get(py_math_supported_fonts, parent_fontfamily, matching_font(parent_fontfamily))
|
||||
end
|
||||
|
||||
# # untested... return a FontProperties object from a Plots.Font
|
||||
# function py_font(font::Font)
|
||||
# pyfont["FontProperties"](
|
||||
@ -816,22 +859,13 @@ function py_set_lims(ax, sp::Subplot, axis::Axis)
|
||||
getproperty(ax, Symbol("set_", letter, "lim"))(lfrom, lto)
|
||||
end
|
||||
|
||||
function py_surround_latextext(latexstring, env)
|
||||
if !isempty(latexstring) && latexstring[1] == '$' && latexstring[end] == '$'
|
||||
unenclosed = latexstring[2:(end - 1)]
|
||||
else
|
||||
unenclosed = latexstring
|
||||
end
|
||||
PyPlot.LaTeXStrings.latexstring(env, "{", unenclosed, "}")
|
||||
end
|
||||
|
||||
function py_set_ticks(sp, ax, ticks, letter, env)
|
||||
function py_set_ticks(sp, ax, ticks, letter)
|
||||
ticks == :auto && return
|
||||
axis = getproperty(ax, Symbol(letter, "axis"))
|
||||
axis = getproperty(ax, get_attr_symbol(letter, :axis))
|
||||
if ticks == :none || ticks === nothing || ticks == false
|
||||
kw = KW()
|
||||
for dir in (:top, :bottom, :left, :right)
|
||||
kw[dir] = kw[Symbol(:label, dir)] = false
|
||||
kw[dir] = kw[get_attr_symbol(:label, dir)] = false
|
||||
end
|
||||
axis."set_tick_params"(; which = "both", kw...)
|
||||
return
|
||||
@ -842,14 +876,7 @@ function py_set_ticks(sp, ax, ticks, letter, env)
|
||||
axis."set_ticks"(ticks)
|
||||
elseif ttype == :ticks_and_labels
|
||||
axis."set_ticks"(ticks[1])
|
||||
|
||||
if get(sp[:extra_kwargs], :rawticklabels, false)
|
||||
tick_labels = ticks[2]
|
||||
else
|
||||
tick_labels = [py_surround_latextext(ticklabel, env) for ticklabel in ticks[2]]
|
||||
end
|
||||
|
||||
axis."set_ticklabels"(tick_labels)
|
||||
axis."set_ticklabels"(ticks[2])
|
||||
else
|
||||
error("Invalid input for $(letter)ticks: $ticks")
|
||||
end
|
||||
@ -887,15 +914,15 @@ function py_set_scale(ax, sp::Subplot, scale::Symbol, letter::Symbol)
|
||||
arg = if scale == :identity
|
||||
"linear"
|
||||
else
|
||||
kw[Symbol(:base, pyletter)] = if scale == :ln
|
||||
kw[get_attr_symbol(:base, pyletter)] = if scale == :ln
|
||||
ℯ
|
||||
elseif scale == :log2
|
||||
2
|
||||
elseif scale == :log10
|
||||
10
|
||||
end
|
||||
axis = sp[Symbol(letter, :axis)]
|
||||
kw[Symbol(:linthresh, pyletter)] =
|
||||
axis = sp[get_attr_symbol(letter, :axis)]
|
||||
kw[get_attr_symbol(:linthresh, pyletter)] =
|
||||
NaNMath.max(1e-16, py_compute_axis_minval(sp, axis))
|
||||
"symlog"
|
||||
end
|
||||
@ -922,7 +949,7 @@ end
|
||||
|
||||
function py_set_axis_colors(sp, ax, a::Axis)
|
||||
py_set_spine_color(ax.spines, py_color(a[:foreground_color_border]))
|
||||
axissym = Symbol(a[:letter], :axis)
|
||||
axissym = get_attr_symbol(a[:letter], :axis)
|
||||
if PyPlot.PyCall.hasproperty(ax, axissym)
|
||||
tickcolor =
|
||||
sp[:framestyle] in (:zerolines, :grid) ?
|
||||
@ -990,6 +1017,9 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
py_thickness_scale(plt, sp[:titlefontsize]),
|
||||
)
|
||||
getproperty(ax, func)."set_family"(sp[:titlefontfamily])
|
||||
getproperty(ax, func)."set_math_fontfamily"(
|
||||
py_get_matching_math_font(sp[:titlefontfamily]),
|
||||
)
|
||||
getproperty(ax, func)."set_color"(py_color(sp[:titlefontcolor]))
|
||||
# ax[:set_title](sp[:title], loc = loc)
|
||||
end
|
||||
@ -1082,6 +1112,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
sp[:colorbar_title],
|
||||
size = py_thickness_scale(plt, sp[:colorbar_titlefontsize]),
|
||||
family = sp[:colorbar_titlefontfamily],
|
||||
math_fontfamily = py_get_matching_math_font(sp[:colorbar_titlefontfamily]),
|
||||
color = py_color(sp[:colorbar_titlefontcolor]),
|
||||
)
|
||||
|
||||
@ -1089,9 +1120,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
cb."formatter".set_powerlimits((-Inf, Inf))
|
||||
cb."update_ticks"()
|
||||
|
||||
env = "\\mathregular" # matches the outer fonts https://matplotlib.org/tutorials/text/mathtext.html
|
||||
ticks = get_colorbar_ticks(sp)
|
||||
|
||||
if sp[:colorbar] in (:top, :bottom)
|
||||
axis = sp[:xaxis] # colorbar inherits from x axis
|
||||
cbar_axis = cb."ax"."xaxis"
|
||||
@ -1103,11 +1132,14 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
end
|
||||
py_set_scale(cb.ax, sp, sp[:colorbar_scale], ticks_letter)
|
||||
sp[:colorbar_ticks] == :native ? nothing :
|
||||
py_set_ticks(sp, cb.ax, ticks, ticks_letter, env)
|
||||
py_set_ticks(sp, cb.ax, ticks, ticks_letter)
|
||||
|
||||
for lab in cbar_axis."get_ticklabels"()
|
||||
lab."set_fontsize"(py_thickness_scale(plt, sp[:colorbar_tickfontsize]))
|
||||
lab."set_family"(sp[:colorbar_tickfontfamily])
|
||||
lab."set_math_fontfamily"(
|
||||
py_get_matching_math_font(sp[:colorbar_tickfontfamily]),
|
||||
)
|
||||
lab."set_color"(py_color(sp[:colorbar_tickfontcolor]))
|
||||
end
|
||||
|
||||
@ -1193,7 +1225,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
|
||||
# axis attributes
|
||||
for letter in (:x, :y, :z)
|
||||
axissym = Symbol(letter, :axis)
|
||||
axissym = get_attr_symbol(letter, :axis)
|
||||
PyPlot.PyCall.hasproperty(ax, axissym) || continue
|
||||
axis = sp[axissym]
|
||||
pyaxis = getproperty(ax, axissym)
|
||||
@ -1203,7 +1235,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
end
|
||||
|
||||
py_set_scale(ax, sp, axis)
|
||||
axis[:ticks] == :native ? nothing : py_set_lims(ax, sp, axis)
|
||||
py_set_lims(ax, sp, axis)
|
||||
if ispolar(sp) && letter == :y
|
||||
ax."set_rlabel_position"(90)
|
||||
end
|
||||
@ -1217,6 +1249,8 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
fontProperties = PyPlot.PyCall.PyDict(
|
||||
Dict(
|
||||
"family" => axis[:tickfontfamily],
|
||||
"math_fontfamily" =>
|
||||
py_get_matching_math_font(axis[:tickfontfamily]),
|
||||
"size" => py_thickness_scale(plt, axis[:tickfontsize]),
|
||||
"rotation" => axis[:tickfontrotation],
|
||||
),
|
||||
@ -1236,10 +1270,14 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
)
|
||||
end
|
||||
|
||||
# workaround to set mathtext.fontspec per Text element
|
||||
env = "\\mathregular" # matches the outer fonts https://matplotlib.org/tutorials/text/mathtext.html
|
||||
py_set_ticks(sp, ax, ticks, letter)
|
||||
|
||||
if axis[:ticks] == :native # It is easier to reset than to account for this
|
||||
py_set_lims(ax, sp, axis)
|
||||
pyaxis.set_major_locator(pyticker.AutoLocator())
|
||||
pyaxis.set_major_formatter(pyticker.ScalarFormatter())
|
||||
end
|
||||
|
||||
axis[:ticks] == :native ? nothing : py_set_ticks(sp, ax, ticks, letter, env)
|
||||
# Tick marks
|
||||
intensity = 0.5 # This value corresponds to scaling of other grid elements
|
||||
pyaxis."set_tick_params"(
|
||||
@ -1255,6 +1293,9 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
end
|
||||
pyaxis."label"."set_fontsize"(py_thickness_scale(plt, axis[:guidefontsize]))
|
||||
pyaxis."label"."set_family"(axis[:guidefontfamily])
|
||||
pyaxis."label"."set_math_fontfamily"(
|
||||
py_get_matching_math_font(axis[:guidefontfamily]),
|
||||
)
|
||||
|
||||
if (RecipesPipeline.is3d(sp))
|
||||
pyaxis."set_rotate_label"(false)
|
||||
@ -1327,7 +1368,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
if !ispolar(sp)
|
||||
ax.spines[string(dir)].set_visible(false)
|
||||
end
|
||||
kw[dir] = kw[Symbol(:label, dir)] = false
|
||||
kw[dir] = kw[get_attr_symbol(:label, dir)] = false
|
||||
end
|
||||
ax."xaxis"."set_tick_params"(; which = "both", kw...)
|
||||
end
|
||||
@ -1337,7 +1378,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
if !ispolar(sp)
|
||||
ax.spines[string(dir)].set_visible(false)
|
||||
end
|
||||
kw[dir] = kw[Symbol(:label, dir)] = false
|
||||
kw[dir] = kw[get_attr_symbol(:label, dir)] = false
|
||||
end
|
||||
ax."yaxis"."set_tick_params"(; which = "both", kw...)
|
||||
end
|
||||
@ -1594,6 +1635,7 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
|
||||
leg."get_title"(),
|
||||
color = py_color(sp[:legendtitlefontcolor]),
|
||||
family = sp[:legendtitlefontfamily],
|
||||
math_fontfamily = py_get_matching_math_font(sp[:legendtitlefontfamily]),
|
||||
fontsize = py_thickness_scale(plt, sp[:legendtitlefontsize]),
|
||||
)
|
||||
end
|
||||
@ -1603,6 +1645,7 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
|
||||
txt,
|
||||
color = py_color(sp[:legendfontcolor]),
|
||||
family = sp[:legendfontfamily],
|
||||
math_fontfamily = py_get_matching_math_font(sp[:legendtitlefontfamily]),
|
||||
fontsize = py_thickness_scale(plt, sp[:legendfontsize]),
|
||||
)
|
||||
end
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
|
||||
# https://github.com/Evizero/UnicodePlots.jl
|
||||
# https://github.com/JuliaPlots/UnicodePlots.jl
|
||||
|
||||
# don't warn on unsupported... there's just too many warnings!!
|
||||
warn_on_unsupported_args(::UnicodePlotsBackend, plotattributes::KW) = nothing
|
||||
warn_on_unsupported_args(::UnicodePlotsBackend, plotattributes) = nothing
|
||||
|
||||
# --------------------------------------------------------------------------------------
|
||||
|
||||
_canvas_map() = (
|
||||
# ------------------------------------------------------------------------------------------
|
||||
const _canvas_map = (
|
||||
ascii = UnicodePlots.AsciiCanvas,
|
||||
block = UnicodePlots.BlockCanvas,
|
||||
braille = UnicodePlots.BrailleCanvas,
|
||||
@ -16,128 +14,129 @@ _canvas_map() = (
|
||||
lookup = UnicodePlots.LookupCanvas,
|
||||
)
|
||||
|
||||
# do all the magic here... build it all at once, since we need to know about all the series at the very beginning
|
||||
function rebuildUnicodePlot!(plt::Plot, width, height)
|
||||
plt.o = []
|
||||
# do all the magic here... build it all at once,
|
||||
# since we need to know about all the series at the very beginning
|
||||
function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
|
||||
plt.o = UnicodePlots.Plot[]
|
||||
|
||||
for sp in plt.subplots
|
||||
xaxis = sp[:xaxis]
|
||||
yaxis = sp[:yaxis]
|
||||
xlim = axis_limits(sp, :x)
|
||||
ylim = axis_limits(sp, :y)
|
||||
xlim = collect(axis_limits(sp, :x))
|
||||
ylim = collect(axis_limits(sp, :y))
|
||||
|
||||
# make vectors
|
||||
xlim = [xlim[1], xlim[2]]
|
||||
ylim = [ylim[1], ylim[2]]
|
||||
|
||||
# we set x/y to have a single point, since we need to create the plot with some data.
|
||||
# since this point is at the bottom left corner of the plot, it shouldn't actually be shown
|
||||
# we set x/y to have a single point,
|
||||
# since we need to create the plot with some data.
|
||||
# since this point is at the bottom left corner of the plot,
|
||||
# it shouldn't actually be shown
|
||||
x = Float64[xlim[1]]
|
||||
y = Float64[ylim[1]]
|
||||
|
||||
# create a plot window with xlim/ylim set, but the X/Y vectors are outside the bounds
|
||||
ct = _canvas_type[]
|
||||
canvas_type = if ct == :auto
|
||||
isijulia() ? UnicodePlots.AsciiCanvas : UnicodePlots.BrailleCanvas
|
||||
# create a plot window with xlim/ylim set,
|
||||
# but the X/Y vectors are outside the bounds
|
||||
canvas_type = if (ct = _canvas_type[]) == :auto
|
||||
isijulia() ? :ascii : :braille
|
||||
else
|
||||
_canvas_map()[ct]
|
||||
ct
|
||||
end
|
||||
|
||||
o = UnicodePlots.Plot(
|
||||
x,
|
||||
y,
|
||||
canvas_type;
|
||||
width = width,
|
||||
height = height,
|
||||
kw = (
|
||||
title = sp[:title],
|
||||
xlabel = xaxis[:guide],
|
||||
ylabel = yaxis[:guide],
|
||||
xscale = xaxis[:scale],
|
||||
yscale = yaxis[:scale],
|
||||
border = isijulia() ? :ascii : :solid,
|
||||
xlim = xlim,
|
||||
ylim = ylim,
|
||||
border = isijulia() ? :ascii : :solid,
|
||||
)
|
||||
# set the axis labels
|
||||
UnicodePlots.xlabel!(o, xaxis[:guide])
|
||||
UnicodePlots.ylabel!(o, yaxis[:guide])
|
||||
|
||||
o = UnicodePlots.Plot(x, y, _canvas_map[canvas_type]; kw...)
|
||||
for series in series_list(sp)
|
||||
o = addUnicodeSeries!(sp, o, series, sp[:legend] != :none, xlim, ylim)
|
||||
o = addUnicodeSeries!(sp, o, kw, series, sp[:legend] != :none)
|
||||
end
|
||||
|
||||
# save the object
|
||||
push!(plt.o, o)
|
||||
for ann in sp[:annotations]
|
||||
x, y, val = locate_annotation(sp, ann...)
|
||||
o = UnicodePlots.annotate!(
|
||||
o, x, y, val.str;
|
||||
color = up_color(val.font.color),
|
||||
halign = val.font.halign, valign = val.font.valign
|
||||
)
|
||||
end
|
||||
|
||||
push!(plt.o, o) # save the object
|
||||
end
|
||||
end
|
||||
|
||||
up_color(col::UnicodePlots.UserColorType) = col
|
||||
up_color(col::RGBA) =
|
||||
(c = convert(ARGB32, col); map(Int, (red(c).i, green(c).i, blue(c).i)))
|
||||
up_color(col) = :auto
|
||||
|
||||
# add a single series
|
||||
function addUnicodeSeries!(
|
||||
sp::Subplot{UnicodePlotsBackend},
|
||||
o,
|
||||
series,
|
||||
addlegend::Bool,
|
||||
xlim,
|
||||
ylim,
|
||||
up::UnicodePlots.Plot,
|
||||
kw, series, addlegend::Bool,
|
||||
)
|
||||
attrs = series.plotattributes
|
||||
st = attrs[:seriestype]
|
||||
st = series[:seriestype]
|
||||
|
||||
# special handling
|
||||
# get the series data and label
|
||||
x, y = if st == :straightline
|
||||
straightline_data(series)
|
||||
elseif st == :shape
|
||||
shape_data(series)
|
||||
else
|
||||
float(series[:x]), float(series[:y])
|
||||
end
|
||||
|
||||
# special handling (src/interface)
|
||||
if st == :histogram2d
|
||||
return UnicodePlots.densityplot!(o, attrs[:x], attrs[:y])
|
||||
kw[:xlim][:] .= kw[:ylim][:] .= 0
|
||||
return UnicodePlots.densityplot(x, y; kw...)
|
||||
elseif st == :heatmap
|
||||
rng = range(0, 1, length = length(UnicodePlots.COLOR_MAP_DATA[:viridis]))
|
||||
cmap = [(red(c), green(c), blue(c)) for c in get(get_colorgradient(series), rng)]
|
||||
return UnicodePlots.heatmap(
|
||||
series[:z].surf;
|
||||
title = sp[:title],
|
||||
zlabel = sp[:colorbar_title],
|
||||
colormap = cmap,
|
||||
zlabel = sp[:colorbar_title], colormap = cmap, kw...
|
||||
)
|
||||
elseif st == :spy
|
||||
return UnicodePlots.spy(series[:z].surf; title = sp[:title])
|
||||
return UnicodePlots.spy(series[:z].surf; kw...)
|
||||
end
|
||||
|
||||
# now use the ! functions to add to the plot
|
||||
if st in (:path, :straightline)
|
||||
if st in (:path, :straightline, :shape)
|
||||
func = UnicodePlots.lineplot!
|
||||
elseif st == :scatter || attrs[:markershape] != :none
|
||||
elseif st == :scatter || series[:markershape] != :none
|
||||
func = UnicodePlots.scatterplot!
|
||||
# elseif st == :bar
|
||||
# func = UnicodePlots.barplot!
|
||||
elseif st == :shape
|
||||
func = UnicodePlots.lineplot!
|
||||
else
|
||||
error("Series type $st not supported by UnicodePlots")
|
||||
end
|
||||
|
||||
# get the series data and label
|
||||
x, y = if st == :straightline
|
||||
straightline_data(attrs)
|
||||
elseif st == :shape
|
||||
shape_data(attrs)
|
||||
else
|
||||
[collect(float(attrs[s])) for s in (:x, :y)]
|
||||
end
|
||||
label = addlegend ? attrs[:label] : ""
|
||||
label = addlegend ? series[:label] : ""
|
||||
|
||||
lc = attrs[:linecolor]
|
||||
if typeof(lc) <: UnicodePlots.UserColorType
|
||||
color = lc
|
||||
elseif typeof(lc) <: RGBA
|
||||
lc = convert(ARGB32, lc)
|
||||
color = map(Int, (red(lc).i, green(lc).i, blue(lc).i))
|
||||
else
|
||||
color = :auto
|
||||
for (n, segment) in enumerate(series_segments(series, st; check = true))
|
||||
i, rng = segment.attr_index, segment.range
|
||||
lc = get_linecolor(series, i)
|
||||
up = func(up, x[rng], y[rng]; color = up_color(lc), name = n == 1 ? label : "")
|
||||
end
|
||||
|
||||
# add the series
|
||||
x, y = RecipesPipeline.unzip(
|
||||
collect(Base.Iterators.filter(xy -> isfinite(xy[1]) && isfinite(xy[2]), zip(x, y))),
|
||||
for (xi, yi, str, fnt) in EachAnn(series[:series_annotations], x, y)
|
||||
up = UnicodePlots.annotate!(
|
||||
up, xi, yi, str;
|
||||
color = up_color(fnt.color), halign = fnt.halign, valign = fnt.valign
|
||||
)
|
||||
func(o, x, y; color = color, name = label)
|
||||
end
|
||||
|
||||
return up
|
||||
end
|
||||
|
||||
# -------------------------------
|
||||
# ------------------------------------------------------------------------------------------
|
||||
|
||||
# since this is such a hack, it's only callable using `png`... should error during normal `show`
|
||||
# since this is such a hack, it's only callable using `png`...
|
||||
# should error during normal `show`
|
||||
function png(plt::Plot{UnicodePlotsBackend}, fn::AbstractString)
|
||||
fn = addExtension(fn, "png")
|
||||
|
||||
@ -145,49 +144,84 @@ function png(plt::Plot{UnicodePlotsBackend}, fn::AbstractString)
|
||||
# make some whitespace and show the plot
|
||||
println("\n\n\n\n\n\n")
|
||||
gui(plt)
|
||||
|
||||
# BEGIN HACK
|
||||
|
||||
# wait while the plot gets drawn
|
||||
sleep(0.5)
|
||||
|
||||
# use osx screen capture when my terminal is maximized and cursor starts at the bottom (I know, right?)
|
||||
# TODO: compute size of plot to adjust these numbers (or maybe implement something good??)
|
||||
# use osx screen capture when my terminal is maximized
|
||||
# and cursor starts at the bottom (I know, right?)
|
||||
run(`screencapture -R50,600,700,420 $fn`)
|
||||
|
||||
# END HACK (phew)
|
||||
return
|
||||
elseif Sys.islinux()
|
||||
run(`clear`)
|
||||
gui(plt)
|
||||
println()
|
||||
run(`import -window $(ENV["WINDOWID"]) $fn`)
|
||||
return
|
||||
end
|
||||
|
||||
error(
|
||||
"Can only savepng on MacOS or Linux with UnicodePlots (though even then I wouldn't do it)",
|
||||
"Can only savepng on MacOS or Linux with UnicodePlots " *
|
||||
"(though even then I wouldn't do it)"
|
||||
)
|
||||
end
|
||||
|
||||
# -------------------------------
|
||||
|
||||
# we don't do very much for subplots... just stack them vertically
|
||||
|
||||
function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
|
||||
w, h = plt[:size]
|
||||
plt.attr[:color_palette] = [RGB(0, 0, 0)]
|
||||
rebuildUnicodePlot!(plt, div(w, 10), div(h, 20))
|
||||
end
|
||||
# ------------------------------------------------------------------------------------------
|
||||
Base.show(plt::Plot{UnicodePlotsBackend}) = show(stdout, plt)
|
||||
Base.show(io::IO, plt::Plot{UnicodePlotsBackend}) = _show(io, MIME("text/plain"), plt)
|
||||
|
||||
function _show(io::IO, ::MIME"text/plain", plt::Plot{UnicodePlotsBackend})
|
||||
unicodeplots_rebuild(plt)
|
||||
foreach(x -> show(io, x), plt.o)
|
||||
nr, nc = size(plt.layout)
|
||||
lines_colored = Array{Union{Nothing,Vector{String}}}(undef, nr, nc)
|
||||
lines_uncolored = copy(lines_colored)
|
||||
l_max = zeros(Int, nr)
|
||||
w_max = zeros(Int, nc)
|
||||
buf = IOBuffer()
|
||||
cbuf = IOContext(buf, :color => true)
|
||||
re_col = r"\x1B\[[0-9;]*[a-zA-Z]"
|
||||
sps = 0
|
||||
for r in 1:nr
|
||||
lmax = 0
|
||||
for c in 1:nc
|
||||
l = plt.layout[r, c]
|
||||
if l isa GridLayout && size(l) != (1, 1)
|
||||
@error "UnicodePlots: complex nested layout is currently unsupported !"
|
||||
else
|
||||
if get(l.attr, :blank, false)
|
||||
lines_colored[r, c] = lines_uncolored[r, c] = nothing
|
||||
else
|
||||
sp = plt.o[sps += 1]
|
||||
show(cbuf, sp)
|
||||
colored = String(take!(buf))
|
||||
uncolored = replace(colored, re_col => "")
|
||||
lines_colored[r, c] = lc = split(colored, "\n")
|
||||
lines_uncolored[r, c] = lu = split(uncolored, "\n")
|
||||
lmax = max(length(lc), lmax)
|
||||
w_max[c] = max(maximum(length.(lu)), w_max[c])
|
||||
end
|
||||
end
|
||||
end
|
||||
l_max[r] = lmax
|
||||
end
|
||||
empty = String[' '^w for w ∈ w_max]
|
||||
for r in 1:nr
|
||||
for n in 1:l_max[r]
|
||||
for c in 1:nc
|
||||
pre = c == 1 ? '\0' : ' '
|
||||
lc = lines_colored[r, c]
|
||||
if lc === nothing || length(lc) < n
|
||||
print(io, pre, empty[c])
|
||||
else
|
||||
lu = lines_uncolored[r, c]
|
||||
print(io, pre, lc[n], ' '^(w_max[c] - length(lu[n])))
|
||||
end
|
||||
end
|
||||
println(io)
|
||||
end
|
||||
r < nr && println(io)
|
||||
end
|
||||
nothing
|
||||
end
|
||||
|
||||
function _display(plt::Plot{UnicodePlotsBackend})
|
||||
unicodeplots_rebuild(plt)
|
||||
map(show, plt.o)
|
||||
map(display, plt.o)
|
||||
nothing
|
||||
end
|
||||
|
||||
@ -321,7 +321,7 @@ function scalefontsizes(factor::Number)
|
||||
|
||||
for letter in (:x, :y, :z)
|
||||
for k in keys(_initial_ax_fontsizes)
|
||||
scalefontsize(Symbol(letter, k), factor)
|
||||
scalefontsize(get_attr_symbol(letter, k), factor)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -343,9 +343,9 @@ function scalefontsizes()
|
||||
for letter in (:x, :y, :z)
|
||||
for k in keys(_initial_ax_fontsizes)
|
||||
if k in keys(_initial_fontsizes)
|
||||
f = default(Symbol(letter, k))
|
||||
f = default(get_attr_symbol(letter, k))
|
||||
factor = f / _initial_fontsizes[k]
|
||||
scalefontsize(Symbol(letter, k), 1.0 / factor)
|
||||
scalefontsize(get_attr_symbol(letter, k), 1.0 / factor)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -1250,21 +1250,19 @@ _backend_skips = Dict(
|
||||
],
|
||||
:inspectdr => [4, 6, 10, 22, 24, 28, 30, 38, 43, 45, 47, 48, 49, 50, 51, 55],
|
||||
:unicodeplots => [
|
||||
5, # limits issue
|
||||
6, # embedded images unsupported
|
||||
10, # histogram2d
|
||||
13, # markers unsupported
|
||||
16, # subplots unsupported
|
||||
17, # grid layout unsupported
|
||||
20, # annotations unsupported
|
||||
16, # nested layout unsupported
|
||||
21, # custom markers unsupported
|
||||
22, # contours unsupported
|
||||
24, # 3D unsupported
|
||||
26, # subplots unsupported
|
||||
29, # layout unsupported
|
||||
26, # nested layout unsupported
|
||||
27, # polar plots unsupported
|
||||
29, # nested layout unsupported
|
||||
33, # grid lines unsupported
|
||||
34, # framestyles unsupported
|
||||
34, # framestyle unsupported
|
||||
37, # ribbons / filled unsupported
|
||||
38, # histogram2D
|
||||
43, # heatmap with DateTime
|
||||
45, # error bars
|
||||
47, # mesh3D unsupported
|
||||
|
||||
@ -250,12 +250,12 @@ function _subplot_setup(plt::Plot, plotattributes::AKW, kw_list::Vector{KW})
|
||||
v = v[series_idx(kw_list, kw)]
|
||||
end
|
||||
for letter in (:x, :y, :z)
|
||||
attr[Symbol(letter, k)] = v
|
||||
attr[get_attr_symbol(letter, k)] = v
|
||||
end
|
||||
end
|
||||
for k in (:scale,), letter in (:x, :y, :z)
|
||||
# Series recipes may need access to this information
|
||||
lk = Symbol(letter, k)
|
||||
lk = get_attr_symbol(letter, k)
|
||||
if haskey(attr, lk)
|
||||
kw[lk] = attr[lk]
|
||||
end
|
||||
|
||||
@ -7,9 +7,10 @@ ismultiversion = false
|
||||
@static if !should_precompile
|
||||
# nothing
|
||||
elseif !ismultios && !ismultiversion
|
||||
@static if isfile(
|
||||
joinpath(@__DIR__, "../deps/SnoopCompile/precompile/precompile_Plots.jl"),
|
||||
)
|
||||
@static if isfile(joinpath(
|
||||
@__DIR__,
|
||||
"../deps/SnoopCompile/precompile/precompile_Plots.jl",
|
||||
))
|
||||
include("../deps/SnoopCompile/precompile/precompile_Plots.jl")
|
||||
_precompile_()
|
||||
end
|
||||
|
||||
16
src/utils.jl
16
src/utils.jl
@ -205,14 +205,14 @@ maketuple(x::Tuple{T,S}) where {T,S} = x
|
||||
for i in 2:4
|
||||
@eval begin
|
||||
RecipesPipeline.unzip(
|
||||
v::Union{AVec{<:Tuple{Vararg{T,$i} where T}},AVec{<:GeometryBasics.Point{$i}}},
|
||||
v::Union{AVec{<:NTuple{$i,T} where T},AVec{<:GeometryBasics.Point{$i}}},
|
||||
) = $(Expr(:tuple, (:([t[$j] for t in v]) for j in 1:i)...))
|
||||
end
|
||||
end
|
||||
|
||||
RecipesPipeline.unzip(
|
||||
::Union{AVec{<:GeometryBasics.Point{N}},AVec{<:Tuple{Vararg{T,N} where T}}},
|
||||
) where {N} = error("$N-dimensional unzip not implemented.")
|
||||
RecipesPipeline.unzip(::Union{AVec{<:GeometryBasics.Point{N}},AVec{<:NTuple{N,T} where T}}) where {N} =
|
||||
error("$N-dimensional unzip not implemented.")
|
||||
|
||||
RecipesPipeline.unzip(::Union{AVec{<:GeometryBasics.Point},AVec{<:Tuple}}) =
|
||||
error("Can't unzip points of different dimensions.")
|
||||
|
||||
@ -816,7 +816,7 @@ end
|
||||
function extend_series_data!(series::Series, v, letter)
|
||||
copy_series!(series, letter)
|
||||
d = extend_by_data!(series[letter], v)
|
||||
expand_extrema!(series[:subplot][Symbol(letter, :axis)], d)
|
||||
expand_extrema!(series[:subplot][get_attr_symbol(letter, :axis)], d)
|
||||
return d
|
||||
end
|
||||
|
||||
@ -1214,3 +1214,9 @@ function mesh3d_triangles(x, y, z, cns)
|
||||
end
|
||||
return X, Y, Z
|
||||
end
|
||||
|
||||
# cache joined symbols so they can be looked up instead of constructed each time
|
||||
const _attrsymbolcache = Dict{Symbol,Dict{Symbol,Symbol}}()
|
||||
|
||||
get_attr_symbol(letter::Symbol, keyword::String) = get_attr_symbol(letter, Symbol(keyword))
|
||||
get_attr_symbol(letter::Symbol, keyword::Symbol) = _attrsymbolcache[letter][keyword]
|
||||
|
||||
163
test/runtests.jl
163
test/runtests.jl
@ -1,18 +1,20 @@
|
||||
using Plots: guidefont, series_annotations, PLOTS_SEED
|
||||
import ImageMagick
|
||||
|
||||
using VisualRegressionTests
|
||||
using Plots
|
||||
using Random
|
||||
using StableRNGs
|
||||
using Test
|
||||
using TestImages
|
||||
using FileIO
|
||||
using Gtk
|
||||
using LibGit2
|
||||
import GeometryBasics
|
||||
using Dates
|
||||
using RecipesBase
|
||||
using StableRNGs
|
||||
using TestImages
|
||||
using LibGit2
|
||||
using Random
|
||||
using FileIO
|
||||
using Plots
|
||||
using Dates
|
||||
using JSON
|
||||
using Test
|
||||
using Gtk
|
||||
|
||||
import GeometryBasics
|
||||
import ImageMagick
|
||||
|
||||
@testset "Infrastructure" begin
|
||||
@test_nowarn JSON.Parser.parse(
|
||||
@ -33,7 +35,7 @@ end
|
||||
end
|
||||
Plots.plotly_local_file_path[] = nothing
|
||||
Plots.use_local_dependencies[] = temp
|
||||
end # testset
|
||||
end
|
||||
|
||||
include("test_defaults.jl")
|
||||
include("test_pipeline.jl")
|
||||
@ -55,7 +57,6 @@ function reference_file(backend, i, version)
|
||||
refdir = reference_dir("Plots", string(backend))
|
||||
fn = "ref$i.png"
|
||||
versions = sort(VersionNumber.(readdir(refdir)), rev = true)
|
||||
|
||||
reffn = joinpath(refdir, string(version), fn)
|
||||
for v in versions
|
||||
tmpfn = joinpath(refdir, string(v), fn)
|
||||
@ -64,7 +65,6 @@ function reference_file(backend, i, version)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
return reffn
|
||||
end
|
||||
|
||||
@ -79,9 +79,10 @@ if !isdir(reference_dir())
|
||||
end
|
||||
|
||||
include("imgcomp.jl")
|
||||
# don't actually show the plots
|
||||
Random.seed!(PLOTS_SEED)
|
||||
default(show = false, reuse = true)
|
||||
|
||||
default(show = false, reuse = true) # don't actually show the plots
|
||||
|
||||
is_ci() = get(ENV, "CI", "false") == "true"
|
||||
const PLOTS_IMG_TOL = parse(Float64, get(ENV, "PLOTS_IMG_TOL", is_ci() ? "1e-4" : "1e-5"))
|
||||
|
||||
@ -106,66 +107,8 @@ const PLOTS_IMG_TOL = parse(Float64, get(ENV, "PLOTS_IMG_TOL", is_ci() ? "1e-4"
|
||||
# image_comparison_facts(:pgfplotsx, tol=PLOTS_IMG_TOL, skip = Plots._backend_skips[:pgfplotsx])
|
||||
# end
|
||||
|
||||
# 10 Histogram2D
|
||||
|
||||
##
|
||||
|
||||
@testset "Backends" begin
|
||||
@testset "GR" begin
|
||||
ENV["PLOTS_TEST"] = "true"
|
||||
ENV["GKSwstype"] = "100"
|
||||
@test gr() == Plots.GRBackend()
|
||||
@test backend() == Plots.GRBackend()
|
||||
|
||||
@static if haskey(ENV, "APPVEYOR")
|
||||
@info "Skipping GR image comparison tests on AppVeyor"
|
||||
else
|
||||
image_comparison_facts(
|
||||
:gr,
|
||||
tol = PLOTS_IMG_TOL,
|
||||
skip = Plots._backend_skips[:gr],
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@testset "UnicodePlots" begin
|
||||
@test unicodeplots() == Plots.UnicodePlotsBackend()
|
||||
@test backend() == Plots.UnicodePlotsBackend()
|
||||
|
||||
# lets just make sure it runs without error
|
||||
p = plot(rand(10))
|
||||
@test isa(p, Plots.Plot) == true
|
||||
@test isa(display(p), Nothing) == true
|
||||
p = bar(randn(10))
|
||||
@test isa(p, Plots.Plot) == true
|
||||
@test isa(display(p), Nothing) == true
|
||||
p = plot([1, 2], [3, 4])
|
||||
annotate!(p, [(1.5, 3.2, Plots.text("Test", :red, :center))])
|
||||
hline!(p, [3.1])
|
||||
@test isa(p, Plots.Plot) == true
|
||||
@test isa(display(p), Nothing) == true
|
||||
p = plot([Dates.Date(2019, 1, 1), Dates.Date(2019, 2, 1)], [3, 4])
|
||||
hline!(p, [3.1])
|
||||
annotate!(p, [(Dates.Date(2019, 1, 15), 3.2, Plots.text("Test", :red, :center))])
|
||||
@test isa(p, Plots.Plot) == true
|
||||
@test isa(display(p), Nothing) == true
|
||||
p = plot([Dates.Date(2019, 1, 1), Dates.Date(2019, 2, 1)], [3, 4])
|
||||
annotate!(p, [(Dates.Date(2019, 1, 15), 3.2, :auto)])
|
||||
hline!(p, [3.1])
|
||||
@test isa(p, Plots.Plot) == true
|
||||
@test isa(display(p), Nothing) == true
|
||||
end
|
||||
|
||||
@testset "PlotlyJS" begin
|
||||
@test plotlyjs() == Plots.PlotlyJSBackend()
|
||||
@test backend() == Plots.PlotlyJSBackend()
|
||||
|
||||
p = plot(rand(10))
|
||||
@test isa(p, Plots.Plot) == true
|
||||
@test_broken isa(display(p), Nothing) == true
|
||||
end
|
||||
end
|
||||
|
||||
@testset "Axes" begin
|
||||
p = plot()
|
||||
axis = p.subplots[1][:xaxis]
|
||||
@ -181,10 +124,12 @@ end
|
||||
end
|
||||
|
||||
@testset "NoFail" begin
|
||||
#ensure backend with tested display
|
||||
# ensure backend with tested display
|
||||
@test unicodeplots() == Plots.UnicodePlotsBackend()
|
||||
@test backend() == Plots.UnicodePlotsBackend()
|
||||
|
||||
dsp = TextDisplay(IOContext(IOBuffer(), :color => true))
|
||||
|
||||
@testset "Plot" begin
|
||||
plots = [
|
||||
histogram([1, 0, 0, 0, 0, 0]),
|
||||
@ -197,21 +142,20 @@ end
|
||||
plot(["a" "b"; missing "d"], [1 2; 3 4]),
|
||||
]
|
||||
for plt in plots
|
||||
display(plt)
|
||||
display(dsp, plt)
|
||||
end
|
||||
@test_nowarn plot(x -> x^2, 0, 2)
|
||||
end
|
||||
|
||||
@testset "Bar" begin
|
||||
p = bar([3, 2, 1], [1, 2, 3])
|
||||
@test isa(p, Plots.Plot)
|
||||
@test isa(display(p), Nothing) == true
|
||||
@test p isa Plots.Plot
|
||||
@test display(dsp, p) isa Nothing
|
||||
end
|
||||
end
|
||||
|
||||
@testset "EmptyAnim" begin
|
||||
anim = @animate for i in []
|
||||
end
|
||||
anim = @animate for i in [] end
|
||||
|
||||
@test_throws ArgumentError gif(anim)
|
||||
end
|
||||
@ -255,3 +199,62 @@ end
|
||||
Plots.process_clims(missing) ==
|
||||
Plots.process_clims(:auto)
|
||||
end
|
||||
|
||||
|
||||
@testset "Backends" begin
|
||||
@testset "UnicodePlots" begin
|
||||
@test unicodeplots() == Plots.UnicodePlotsBackend()
|
||||
@test backend() == Plots.UnicodePlotsBackend()
|
||||
|
||||
io = IOContext(IOBuffer(), :color => true)
|
||||
|
||||
# lets just make sure it runs without error
|
||||
p = plot(rand(10))
|
||||
@test p isa Plots.Plot
|
||||
@test show(io, p) isa Nothing
|
||||
p = bar(randn(10))
|
||||
@test p isa Plots.Plot
|
||||
@test show(io, p) isa Nothing
|
||||
p = plot([1, 2], [3, 4])
|
||||
annotate!(p, [(1.5, 3.2, Plots.text("Test", :red, :center))])
|
||||
hline!(p, [3.1])
|
||||
@test p isa Plots.Plot
|
||||
@test show(io, p) isa Nothing
|
||||
p = plot([Dates.Date(2019, 1, 1), Dates.Date(2019, 2, 1)], [3, 4])
|
||||
hline!(p, [3.1])
|
||||
annotate!(p, [(Dates.Date(2019, 1, 15), 3.2, Plots.text("Test", :red, :center))])
|
||||
@test p isa Plots.Plot
|
||||
@test show(io, p) isa Nothing
|
||||
p = plot([Dates.Date(2019, 1, 1), Dates.Date(2019, 2, 1)], [3, 4])
|
||||
annotate!(p, [(Dates.Date(2019, 1, 15), 3.2, :auto)])
|
||||
hline!(p, [3.1])
|
||||
@test p isa Plots.Plot
|
||||
@test show(io, p) isa Nothing
|
||||
end
|
||||
|
||||
@testset "PlotlyJS" begin
|
||||
@test plotlyjs() == Plots.PlotlyJSBackend()
|
||||
@test backend() == Plots.PlotlyJSBackend()
|
||||
|
||||
p = plot(rand(10))
|
||||
@test p isa Plots.Plot
|
||||
@test_broken display(p) isa Nothing
|
||||
end
|
||||
|
||||
@testset "GR" begin
|
||||
ENV["PLOTS_TEST"] = "true"
|
||||
ENV["GKSwstype"] = "100"
|
||||
@test gr() == Plots.GRBackend()
|
||||
@test backend() == Plots.GRBackend()
|
||||
|
||||
@static if haskey(ENV, "APPVEYOR")
|
||||
@info "Skipping GR image comparison tests on AppVeyor"
|
||||
else
|
||||
image_comparison_facts(
|
||||
:gr,
|
||||
tol = PLOTS_IMG_TOL,
|
||||
skip = Plots._backend_skips[:gr],
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -63,3 +63,58 @@ end
|
||||
@test twpl[:top_margin] == 2Plots.cm
|
||||
@test twpl[:bottom_margin] == 2Plots.cm
|
||||
end
|
||||
|
||||
@testset "axis-aliases" begin
|
||||
p = plot(1:2, xl = "x label")
|
||||
@test p[1][:xaxis][:guide] === "x label"
|
||||
p = plot(1:2, xrange = (0, 3))
|
||||
@test xlims(p) === (0, 3)
|
||||
p = plot(1:2, xtick = [1.25, 1.5, 1.75])
|
||||
@test p[1][:xaxis][:ticks] == [1.25, 1.5, 1.75]
|
||||
p = plot(1:2, xlabelfontsize = 4)
|
||||
@test p[1][:xaxis][:guidefontsize] == 4
|
||||
p = plot(1:2, xgα = .07)
|
||||
@test p[1][:xaxis][:gridalpha] ≈ .07
|
||||
p = plot(1:2, xgridls = :dashdot)
|
||||
@test p[1][:xaxis][:gridstyle] === :dashdot
|
||||
p = plot(1:2, xgridcolor = :red)
|
||||
@test p[1][:xaxis][:foreground_color_grid] === RGBA{Float64}(1.,0.,0.,1.)
|
||||
p = plot(1:2, xminorgridcolor = :red)
|
||||
@test p[1][:xaxis][:foreground_color_minor_grid] === RGBA{Float64}(1.,0.,0.,1.)
|
||||
p = plot(1:2, xgrid_lw = .01)
|
||||
@test p[1][:xaxis][:gridlinewidth] ≈ .01
|
||||
p = plot(1:2, xminorgrid_lw = .01)
|
||||
@test p[1][:xaxis][:minorgridlinewidth] ≈ .01
|
||||
p = plot(1:2, xtickor = :out)
|
||||
@test p[1][:xaxis][:tick_direction] === :out
|
||||
end
|
||||
|
||||
@testset "aliases" begin
|
||||
compare(p::Plots.Plot, s::Symbol, val, op) =
|
||||
op(p[1][:xaxis][s], val) && op(p[1][:yaxis][s], val) && op(p[1][:zaxis][s], val)
|
||||
p = plot(1:2, guide = "all labels")
|
||||
@test compare(p, :guide, "all labels", ===)
|
||||
p = plot(1:2, label = "test")
|
||||
@test compare(p, :guide, "", ===)
|
||||
p = plot(1:2, lim = (0, 3))
|
||||
@test xlims(p) === ylims(p) === zlims(p) === (0,3)
|
||||
p = plot(1:2, tick = [1.25, 1.5, 1.75])
|
||||
@test compare(p,:ticks,[1.25, 1.5, 1.75], ==)
|
||||
p = plot(1:2, labelfontsize = 4)
|
||||
@test compare(p,:guidefontsize,4, ==)
|
||||
p = plot(1:2, gα = .07)
|
||||
@test compare(p,:gridalpha,.07, ≈)
|
||||
p = plot(1:2, gridls = :dashdot)
|
||||
@test compare(p,:gridstyle,:dashdot, ===)
|
||||
p = plot(1:2, gridcolor = :red)
|
||||
@test compare(p,:foreground_color_grid,RGBA{Float64}(1.,0.,0.,1.), ===)
|
||||
p = plot(1:2, minorgridcolor = :red)
|
||||
@test compare(p,:foreground_color_minor_grid,RGBA{Float64}(1.,0.,0.,1.), ===)
|
||||
p = plot(1:2, grid_lw = .01)
|
||||
@test compare(p,:gridlinewidth,.01, ≈)
|
||||
p = plot(1:2, minorgrid_lw = .01)
|
||||
@test compare(p,:minorgridlinewidth,.01, ≈)
|
||||
p = plot(1:2, tickor = :out)
|
||||
@test compare(p,:tick_direction,:out, ===)
|
||||
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user