Refactor marker and line attributes#4505
Conversation
This reverts commit da25f97.
dab5780 to
0efda09
Compare
src/arg_desc.jl
Outdated
| :fillrange => "Number or AbstractVector. Fills area between fillrange and y for line-types, sets the base for bar/stick types, and similar for other types.", | ||
| :fillcolor => "Color Type. Color of the filled area of path or bar types. `:match` will take the value from `:seriescolor`.", | ||
| :fillalpha => "Number in [0,1]. The alpha/opacity override for the fill area. `nothing` (the default) means it will take the alpha value of fillcolor.", |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| :fillrange => "Number or AbstractVector. Fills area between fillrange and y for line-types, sets the base for bar/stick types, and similar for other types.", | |
| :fillcolor => "Color Type. Color of the filled area of path or bar types. `:match` will take the value from `:seriescolor`.", | |
| :fillalpha => "Number in [0,1]. The alpha/opacity override for the fill area. `nothing` (the default) means it will take the alpha value of fillcolor.", | |
| :fillrange => "Number or AbstractVector. Fills area between fillrange and y for line-types, sets the base for bar/stick types, and similar for other types.", | |
| :fillcolor => "Color Type. Color of the filled area of path or bar types. `:match` will take the value from `:seriescolor`.", | |
| :fillalpha => "Number in [0,1]. The alpha/opacity override for the fill area. `nothing` (the default) means it will take the alpha value of fillcolor.", |
src/arg_desc.jl
Outdated
| :fillalpha => "Number in [0,1]. The alpha/opacity override for the fill area. `nothing` (the default) means it will take the alpha value of fillcolor.", | ||
| :markershape => "Symbol, Shape, or AbstractVector. Choose from $(_allMarkers).", | ||
| :marker_shape => "Symbol, Shape, or AbstractVector. Choose from $(_allMarkers).", | ||
| :fillstyle => "Symbol. Style of the fill area. `nothing` (the default) means solid fill. Choose from :/, :\\, :|, :-, :+, :x", |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| :fillstyle => "Symbol. Style of the fill area. `nothing` (the default) means solid fill. Choose from :/, :\\, :|, :-, :+, :x", | |
| :fillstyle => "Symbol. Style of the fill area. `nothing` (the default) means solid fill. Choose from :/, :\\, :|, :-, :+, :x", |
src/args.jl
Outdated
| end | ||
|
|
||
| const _keyAliases = Dict{Symbol,Symbol}() | ||
| const _generalAliases = ("background" => "bg", "foreground" => "fg", "pointsize" => "size", "yfill" => "fill", "alpha" => "a", "alpha" => "opacity", "alpha" => "α") |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| const _generalAliases = ("background" => "bg", "foreground" => "fg", "pointsize" => "size", "yfill" => "fill", "alpha" => "a", "alpha" => "opacity", "alpha" => "α") | |
| const _generalAliases = ( | |
| "background" => "bg", | |
| "foreground" => "fg", | |
| "pointsize" => "size", | |
| "yfill" => "fill", | |
| "alpha" => "a", | |
| "alpha" => "opacity", | |
| "alpha" => "α", | |
| ) |
src/args.jl
Outdated
| plotattributes[:marker_stroke_color] = if plotattributes[:marker_stroke_color] === :match | ||
| plot_color(sp[:foreground_color_subplot]) | ||
| elseif plotattributes[:markerstrokecolor] === :auto | ||
| get_series_color(plotattributes[:markercolor], sp, plotIndex, stype) | ||
| elseif plotattributes[:marker_stroke_color] === :auto | ||
| get_series_color(plotattributes[:marker_color], sp, plotIndex, stype) | ||
| else | ||
| get_series_color(plotattributes[:markerstrokecolor], sp, plotIndex, stype) | ||
| get_series_color(plotattributes[:marker_stroke_color], sp, plotIndex, stype) | ||
| end |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| plotattributes[:marker_stroke_color] = if plotattributes[:marker_stroke_color] === :match | |
| plot_color(sp[:foreground_color_subplot]) | |
| elseif plotattributes[:markerstrokecolor] === :auto | |
| get_series_color(plotattributes[:markercolor], sp, plotIndex, stype) | |
| elseif plotattributes[:marker_stroke_color] === :auto | |
| get_series_color(plotattributes[:marker_color], sp, plotIndex, stype) | |
| else | |
| get_series_color(plotattributes[:markerstrokecolor], sp, plotIndex, stype) | |
| get_series_color(plotattributes[:marker_stroke_color], sp, plotIndex, stype) | |
| end | |
| plotattributes[:marker_stroke_color] = | |
| if plotattributes[:marker_stroke_color] === :match | |
| plot_color(sp[:foreground_color_subplot]) | |
| elseif plotattributes[:marker_stroke_color] === :auto | |
| get_series_color(plotattributes[:marker_color], sp, plotIndex, stype) | |
| else | |
| get_series_color(plotattributes[:marker_stroke_color], sp, plotIndex, stype) | |
| end |
src/args.jl
Outdated
| pl_aliases = Plots.makeplural.(aliases) | ||
| push!( | ||
| insert_block.args, | ||
| :(Plots.add_aliases($(QuoteNode(exp_key)), $(aliases)..., $(pl_aliases)..., $(Iterators.flatten(Plots.make_non_underscore.(aliases)))..., $(Iterators.flatten(Plots.make_non_underscore.(pl_aliases)))..., | ||
| )) | ||
| ) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| pl_aliases = Plots.makeplural.(aliases) | |
| push!( | |
| insert_block.args, | |
| :(Plots.add_aliases($(QuoteNode(exp_key)), $(aliases)..., $(pl_aliases)..., $(Iterators.flatten(Plots.make_non_underscore.(aliases)))..., $(Iterators.flatten(Plots.make_non_underscore.(pl_aliases)))..., | |
| )) | |
| ) | |
| pl_aliases = Plots.makeplural.(aliases) | |
| push!( | |
| insert_block.args, | |
| :(Plots.add_aliases( | |
| $(QuoteNode(exp_key)), | |
| $(aliases)..., | |
| $(pl_aliases)..., | |
| $(Iterators.flatten(Plots.make_non_underscore.(aliases)))..., | |
| $(Iterators.flatten(Plots.make_non_underscore.(pl_aliases)))..., | |
| )), | |
| ) |
src/components.jl
Outdated
| :legend_position => (:legend, :leg, :key), | ||
| :legend_background_color => (:background_legend, :background_colour_legend, :background_color_legend), | ||
| :legend_foreground_color => (:foreground_legend, :foreground_colour_legend, :foreground_colour_legend) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| :legend_position => (:legend, :leg, :key), | |
| :legend_background_color => (:background_legend, :background_colour_legend, :background_color_legend), | |
| :legend_foreground_color => (:foreground_legend, :foreground_colour_legend, :foreground_colour_legend) | |
| :legend_position => (:legend, :leg, :key), | |
| :legend_background_color => | |
| (:background_legend, :background_colour_legend, :background_color_legend), | |
| :legend_foreground_color => | |
| (:foreground_legend, :foreground_colour_legend, :foreground_colour_legend), |
src/components.jl
Outdated
| :line_alpha => (:lalpha,), | ||
| :line_width => (:w, :width, :lw), | ||
| :line_style => (:s, :style, :ls), | ||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
src/components.jl
Outdated
| :marker_stroke_alpha => (:msalpha,), | ||
| :marker_stroke_width => (:msw, :mswidth), | ||
| ) | ||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
test/test_args.jl
Outdated
| :legend_title_font_color, | ||
| ) :aliases = Dict( | ||
| :legend_position => (:legend, :leg, :key), | ||
| :legend_background_color => (:background_legend, :background_colour_legend, :background_color_legend), |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| :legend_background_color => (:background_legend, :background_colour_legend, :background_color_legend), | |
| :legend_background_color => | |
| (:background_legend, :background_colour_legend, :background_color_legend), |
test/test_recipes.jl
Outdated
| @test p[1][1][:line_style] == :solid | ||
| @test p[1][2][:line_style] == :dash | ||
| @test p[1][3][:line_style] == :dot |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| @test p[1][1][:line_style] == :solid | |
| @test p[1][2][:line_style] == :dash | |
| @test p[1][3][:line_style] == :dot | |
| @test p[1][1][:line_style] == :solid | |
| @test p[1][2][:line_style] == :dash | |
| @test p[1][3][:line_style] == :dot |
Benchmark resultJudge resultBenchmark Report for /home/runner/work/Plots.jl/Plots.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTargetBaselineTarget resultBenchmark Report for /home/runner/work/Plots.jl/Plots.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoBaseline resultBenchmark Report for /home/runner/work/Plots.jl/Plots.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoRuntime information
|
src/args.jl
Outdated
| defexpr = ei.args[2] # defexpr | ||
| key_dict[var] = defexpr | ||
| # filter e.g. marker::Marker = Marker(...) | ||
| if !(defexpr isa Expr && defexpr.head == :call && defexpr.args[1] == ei.args[1].args[2]) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| if !(defexpr isa Expr && defexpr.head == :call && defexpr.args[1] == ei.args[1].args[2]) | |
| if !( | |
| defexpr isa Expr && | |
| defexpr.head == :call && | |
| defexpr.args[1] == ei.args[1].args[2] | |
| ) |
src/components.jl
Outdated
| :legend_position => (:legend, :leg, :key), | ||
| :legend_background_color => (:background_legend, :background_colour_legend, :background_color_legend), | ||
| :legend_foreground_color => (:foreground_legend, :foreground_color_legend, :foreground_colour_legend) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| :legend_position => (:legend, :leg, :key), | |
| :legend_background_color => (:background_legend, :background_colour_legend, :background_color_legend), | |
| :legend_foreground_color => (:foreground_legend, :foreground_color_legend, :foreground_colour_legend) | |
| :legend_position => (:legend, :leg, :key), | |
| :legend_background_color => | |
| (:background_legend, :background_colour_legend, :background_color_legend), | |
| :legend_foreground_color => | |
| (:foreground_legend, :foreground_color_legend, :foreground_colour_legend), |
Benchmark resultJudge resultBenchmark Report for /home/runner/work/Plots.jl/Plots.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTargetBaselineTarget resultBenchmark Report for /home/runner/work/Plots.jl/Plots.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoBaseline resultBenchmark Report for /home/runner/work/Plots.jl/Plots.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoRuntime information
|
src/consts.jl
Outdated
| const _all_args = | ||
| union(_lettered_all_axis_args, _all_subplot_args, _all_series_args, _all_plot_args) | ||
|
|
||
| const _all_segmenting_attributes = Set(_segmenting_vector_attributes ∪ _segmenting_array_attributes ∪ reduce(vcat, aliases.(_segmenting_array_attributes)) ∪ reduce(vcat, aliases.(_segmenting_vector_attributes))) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| const _all_segmenting_attributes = Set(_segmenting_vector_attributes ∪ _segmenting_array_attributes ∪ reduce(vcat, aliases.(_segmenting_array_attributes)) ∪ reduce(vcat, aliases.(_segmenting_vector_attributes))) | |
| const _all_segmenting_attributes = Set( | |
| _segmenting_vector_attributes ∪ _segmenting_array_attributes ∪ | |
| reduce(vcat, aliases.(_segmenting_array_attributes)) ∪ | |
| reduce(vcat, aliases.(_segmenting_vector_attributes)), | |
| ) |
Benchmark resultJudge resultBenchmark Report for /home/runner/work/Plots.jl/Plots.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTargetBaselineTarget resultBenchmark Report for /home/runner/work/Plots.jl/Plots.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoBaseline resultBenchmark Report for /home/runner/work/Plots.jl/Plots.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoRuntime information
|
| RB.@recipe function plot( | ||
| t::T1, | ||
| n::N = 1; | ||
| customcolor = :green, | ||
| ) where {N<:Integer} |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| RB.@recipe function plot( | |
| t::T1, | |
| n::N = 1; | |
| customcolor = :green, | |
| ) where {N<:Integer} | |
| RB.@recipe function plot(t::T1, n::N = 1; customcolor = :green) where {N<:Integer} |
RecipesPipeline/src/utils.jl
Outdated
| function DefaultsDict{P}(plot_type::Type{P}, explicit::KW, defaults::KW) where P | ||
| e = KW( key_alias(plot_type, k) => v === :seriestype ? type_alias(plot_type, v) : v for (k, v) in explicit) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| function DefaultsDict{P}(plot_type::Type{P}, explicit::KW, defaults::KW) where P | |
| e = KW( key_alias(plot_type, k) => v === :seriestype ? type_alias(plot_type, v) : v for (k, v) in explicit) | |
| function DefaultsDict{P}(plot_type::Type{P}, explicit::KW, defaults::KW) where {P} | |
| e = KW( | |
| key_alias(plot_type, k) => v === :seriestype ? type_alias(plot_type, v) : v | |
| for (k, v) in explicit | |
| ) |
RecipesPipeline/src/utils.jl
Outdated
| DefaultsDict(pt, e, d) = DefaultsDict{pt}(pt, e, d) | ||
| function Base.merge(d1::DefaultsDict, d2::DefaultsDict) | ||
| @assert d1.plot_type === d2.plot_type | ||
| DefaultsDict(d1.plot_type, merge(d1.explicit, d2.explicit), merge(d1.defaults, d2.defaults)) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| DefaultsDict(d1.plot_type, merge(d1.explicit, d2.explicit), merge(d1.defaults, d2.defaults)) | |
| DefaultsDict( | |
| d1.plot_type, | |
| merge(d1.explicit, d2.explicit), | |
| merge(d1.defaults, d2.defaults), | |
| ) |
RecipesPipeline/test/runtests.jl
Outdated
|
|
||
| @testset "DefaultsDict" begin | ||
| dd = DefaultsDict(Dict(:foo => 1, :bar => missing), Dict(:foo => nothing, :baz => 'x')) | ||
| dd = DefaultsDict(Plots.Plot, Dict(:foo => 1, :bar => missing), Dict(:foo => nothing, :baz => 'x')) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| dd = DefaultsDict(Plots.Plot, Dict(:foo => 1, :bar => missing), Dict(:foo => nothing, :baz => 'x')) | |
| dd = DefaultsDict( | |
| Plots.Plot, | |
| Dict(:foo => 1, :bar => missing), | |
| Dict(:foo => nothing, :baz => 'x'), | |
| ) |
src/arg_desc.jl
Outdated
| :fillrange => (Union{Real,AVec}, "Fills area between fillrange and `y` for line-types, sets the base for `bar`, `sticks` types, and similar for other types."), | ||
| :fillcolor => (ColorType, "Color of the filled area of path or bar types. `:match` will take the value from `:seriescolor`."), | ||
| :fillalpha => (Real, "The alpha/opacity override for the fill area. `nothing` (the default) means it will take the alpha value of fillcolor."), |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| :fillrange => (Union{Real,AVec}, "Fills area between fillrange and `y` for line-types, sets the base for `bar`, `sticks` types, and similar for other types."), | |
| :fillcolor => (ColorType, "Color of the filled area of path or bar types. `:match` will take the value from `:seriescolor`."), | |
| :fillalpha => (Real, "The alpha/opacity override for the fill area. `nothing` (the default) means it will take the alpha value of fillcolor."), | |
| :fillrange => (Union{Real,AVec}, "Fills area between fillrange and `y` for line-types, sets the base for `bar`, `sticks` types, and similar for other types."), | |
| :fillcolor => (ColorType, "Color of the filled area of path or bar types. `:match` will take the value from `:seriescolor`."), | |
| :fillalpha => (Real, "The alpha/opacity override for the fill area. `nothing` (the default) means it will take the alpha value of fillcolor."), |
src/backends/gr.jl
Outdated
| GR.setprojectiontype(0) | ||
| GR.setspace(clims[1], clims[2], 0, 90) | ||
| gr_set_line(get_linewidth(series), get_linestyle(series), get_linecolor(series), series) | ||
| gr_set_line(get_line_width(series), get_line_style(series), get_line_color(series), series) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| gr_set_line(get_line_width(series), get_line_style(series), get_line_color(series), series) | |
| gr_set_line( | |
| get_line_width(series), | |
| get_line_style(series), | |
| get_line_color(series), | |
| series, | |
| ) |
src/backends/inspectdr.jl
Outdated
| size = _inspectdr_mapglyphsize(series[:marker_size]), | ||
| color = _inspectdr_mapcolor( | ||
| plot_color(get_markerstrokecolor(series), get_markerstrokealpha(series)), | ||
| plot_color(get_marker_stroke_color(series), get_marker_stroke_alpha(series)), |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| plot_color(get_marker_stroke_color(series), get_marker_stroke_alpha(series)), | |
| plot_color( | |
| get_marker_stroke_color(series), | |
| get_marker_stroke_alpha(series), | |
| ), |
src/backends/unicodeplots.jl
Outdated
| unsupported_layout_error() | ||
| else | ||
| img = UnicodePlots.png_image(plt.o[sps += 1]; pixelsize = 32) | ||
| img = UnicodePlots.png_image(plt.o[sps += 1]; |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| img = UnicodePlots.png_image(plt.o[sps += 1]; | |
| img = UnicodePlots.png_image( | |
| plt.o[sps += 1]; |
src/consts.jl
Outdated
| const _all_args = | ||
| union(_lettered_all_axis_args, _all_subplot_args, _all_series_args, _all_plot_args) | ||
|
|
||
| const _all_segmenting_attributes = Set(_segmenting_vector_attributes ∪ _segmenting_array_attributes) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| const _all_segmenting_attributes = Set(_segmenting_vector_attributes ∪ _segmenting_array_attributes) | |
| const _all_segmenting_attributes = | |
| Set(_segmenting_vector_attributes ∪ _segmenting_array_attributes) |
test/test_args.jl
Outdated
| @test yticks(pl2) == xticks(pl1) | ||
| @test filter(isfinite, pl1[1][1][:x]) == filter(isfinite, pl2[1][1][:y]) | ||
| @test filter(isfinite, pl1[1][1][:y]) == filter(isfinite, pl2[1][1][:x]) | ||
| @test pl1[1][1][:line_color] == RGBA{Float64}(0.0,0.0,0.0,1.0) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| @test pl1[1][1][:line_color] == RGBA{Float64}(0.0,0.0,0.0,1.0) | |
| @test pl1[1][1][:line_color] == RGBA{Float64}(0.0, 0.0, 0.0, 1.0) |
| plot_type::Type{P} | ||
| explicit::KW | ||
| defaults::KW | ||
| function DefaultsDict{P}(plot_type::Type{P}, explicit::AbstractDict, defaults::AbstractDict) where {P} |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| function DefaultsDict{P}(plot_type::Type{P}, explicit::AbstractDict, defaults::AbstractDict) where {P} | |
| function DefaultsDict{P}( | |
| plot_type::Type{P}, | |
| explicit::AbstractDict, | |
| defaults::AbstractDict, | |
| ) where {P} |
|
|
||
| @testset "DefaultsDict" begin | ||
| dd = DefaultsDict(Dict(:foo => 1, :bar => missing), Dict(:foo => nothing, :baz => 'x')) | ||
| dd = DefaultsDict(MyPlot, Dict(:foo => 1, :bar => missing), Dict(:foo => nothing, :baz => 'x')) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| dd = DefaultsDict(MyPlot, Dict(:foo => 1, :bar => missing), Dict(:foo => nothing, :baz => 'x')) | |
| dd = DefaultsDict( | |
| MyPlot, | |
| Dict(:foo => 1, :bar => missing), | |
| Dict(:foo => nothing, :baz => 'x'), | |
| ) |
Benchmark resultJudge resultBenchmark Report for /home/runner/work/Plots.jl/Plots.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTargetBaselineTarget resultBenchmark Report for /home/runner/work/Plots.jl/Plots.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoBaseline resultBenchmark Report for /home/runner/work/Plots.jl/Plots.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoRuntime information
|
Benchmark resultJudge resultBenchmark Report for /home/runner/work/Plots.jl/Plots.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTargetBaselineTarget resultBenchmark Report for /home/runner/work/Plots.jl/Plots.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoBaseline resultBenchmark Report for /home/runner/work/Plots.jl/Plots.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoRuntime information
|
I have to split #4489 into smaller PRs, to keep things managable.
So this PR only touches marker and line attributes and aliases.