Restructure marker, line, fill, error attributes#4489
Restructure marker, line, fill, error attributes#4489BeastyBlacksmith wants to merge 15 commits intomasterfrom
Conversation
| 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 |
| shape = _cycle(plotattributes[:marker_shape], i) | ||
| cstr, a = pgf_color( | ||
| plot_color(get_markercolor(plotattributes, i), get_markeralpha(plotattributes, i)), | ||
| plot_color(get_marker_color(plotattributes, i), get_marker_alpha(plotattributes, i)), |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| plot_color(get_marker_color(plotattributes, i), get_marker_alpha(plotattributes, i)), | |
| plot_color( | |
| get_marker_color(plotattributes, i), | |
| get_marker_alpha(plotattributes, i), | |
| ), |
| 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_linewidth(series), get_linestyle(series), get_line_color(series), series) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| gr_set_line(get_linewidth(series), get_linestyle(series), get_line_color(series), series) | |
| gr_set_line( | |
| get_linewidth(series), | |
| get_linestyle(series), | |
| get_line_color(series), | |
| series, | |
| ) |
| @add_attributes series struct XErrorBar | ||
| color = :match | ||
| shape = :hline | ||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
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
|
| :yfill_range => "Number or AbstractVector. Fills area between fillrange and y for line-types, sets the base for bar/stick types, and similar for other types.", | ||
| :yfill_color => "Color Type. Color of the filled area of path or bar types. `:match` will take the value from `:seriescolor`.", | ||
| :yfill_alpha => "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 🐶
| :yfill_range => "Number or AbstractVector. Fills area between fillrange and y for line-types, sets the base for bar/stick types, and similar for other types.", | |
| :yfill_color => "Color Type. Color of the filled area of path or bar types. `:match` will take the value from `:seriescolor`.", | |
| :yfill_alpha => "Number in [0,1]. The alpha/opacity override for the fill area. `nothing` (the default) means it will take the alpha value of fillcolor.", | |
| :yfill_range => "Number or AbstractVector. Fills area between fillrange and y for line-types, sets the base for bar/stick types, and similar for other types.", | |
| :yfill_color => "Color Type. Color of the filled area of path or bar types. `:match` will take the value from `:seriescolor`.", | |
| :yfill_alpha => "Number in [0,1]. The alpha/opacity override for the fill area. `nothing` (the default) means it will take the alpha value of fillcolor.", |
| :yfill_color => "Color Type. Color of the filled area of path or bar types. `:match` will take the value from `:seriescolor`.", | ||
| :yfill_alpha => "Number in [0,1]. The alpha/opacity override for the fill area. `nothing` (the default) means it will take the alpha value of fillcolor.", | ||
| :marker_shape => "Symbol, Shape, or AbstractVector. Choose from $(_allMarkers).", | ||
| :yfill_style => "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 🐶
| :yfill_style => "Symbol. Style of the fill area. `nothing` (the default) means solid fill. Choose from :/, :\\, :|, :-, :+, :x", | |
| :yfill_style => "Symbol. Style of the fill area. `nothing` (the default) means solid fill. Choose from :/, :\\, :|, :-, :+, :x", |
| - `level` indicates which group of `plot`, `subplot`, `series`, etc. the keywords belong to. | ||
| - `expr` is the struct definition with default values like `Base.@kwdef` | ||
| - `match_table` is an expression of the form `:match = (symbols)`, with symbols whose default value should be `:match` | ||
| - `args` can be any of the following |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| - `args` can be any of the following | |
| alias_dict = :(:aliases = Dict{Symbol,Symbol}()) |
| gr_set_transparency(get_fillalpha(series)) | ||
| h = gr_contour_levels(series, clims) | ||
| if series[:fillrange] !== nothing | ||
| if series[:yfill_range] !== nothing |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| if series[:yfill_range] !== nothing | |
| gr_set_line( | |
| get_linewidth(series), | |
| get_linestyle(series), | |
| get_line_color(series), | |
| series, | |
| ) |
| plot_color.(map(z -> get(fillgrad, z), z_normalized), series[:yfill_alpha]), z_log | ||
| end | ||
| for i in eachindex(colors) | ||
| isnan(_z[i]) && (colors[i] = set_RGBA_alpha(0, colors[i])) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| isnan(_z[i]) && (colors[i] = set_RGBA_alpha(0, colors[i])) | |
| plot_color.(map(z -> get(fillgrad, z), z_normalized), series[:yfill_alpha]), | |
| z_log |
test/test_args.jl
Outdated
| :legend_title_font_color, | ||
| ) :aliases = Dict( | ||
| (:legend, :leg, :key) => :legend_position, | ||
| (:bg_legend, :bg_color_legend, :background_legend, :background_colour_legend, :bg_colour_legend, :background_color_legend) => :legend_background_color |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| (:bg_legend, :bg_color_legend, :background_legend, :background_colour_legend, :bg_colour_legend, :background_color_legend) => :legend_background_color | |
| ( | |
| :bg_legend, | |
| :bg_color_legend, | |
| :background_legend, | |
| :background_colour_legend, | |
| :bg_colour_legend, | |
| :background_color_legend, | |
| ) => :legend_background_color, |
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
| 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" => "α", | |
| ) |
| :(Plots.add_aliases( | ||
| $(QuoteNode(exp_key)), | ||
| $(QuoteNode(Plots.make_non_underscore(pl_key))), | ||
| $(QuoteNode(Plots.make_non_underscore(pl_key)))..., | ||
| )), | ||
| ) | ||
| if aliases !== nothing |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| :(Plots.add_aliases( | |
| $(QuoteNode(exp_key)), | |
| $(QuoteNode(Plots.make_non_underscore(pl_key))), | |
| $(QuoteNode(Plots.make_non_underscore(pl_key)))..., | |
| )), | |
| ) | |
| if aliases !== nothing | |
| 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)))..., | |
| )), | |
| ) |
| gr_set_line(get_linewidth(series), get_linestyle(series), get_linecolor(series), series) | ||
| gr_set_line(get_linewidth(series), get_linestyle(series), get_line_color(series), series) | ||
| gr_set_transparency(get_fillalpha(series)) | ||
| h = gr_contour_levels(series, clims) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| h = gr_contour_levels(series, clims) | |
| gr_set_line( | |
| get_linewidth(series), | |
| get_linestyle(series), | |
| get_line_color(series), | |
| series, | |
| ) |
| plot_color.(map(z -> get(fillgrad, z), z_normalized), series[:fillalpha]), z_log | ||
| plot_color.(map(z -> get(fillgrad, z), z_normalized), series[:yfill_alpha]), z_log | ||
| end | ||
| for i in eachindex(colors) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| for i in eachindex(colors) | |
| plot_color.(map(z -> get(fillgrad, z), z_normalized), series[:yfill_alpha]), | |
| z_log |
| :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), |
| :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
| alpha = nothing | ||
| style = nothing | ||
| end aliases = Dict( | ||
| :yfill_color => (:fc, :fcolor, :fcolour,), |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| :yfill_color => (:fc, :fcolor, :fcolour,), | |
| :yfill_color => (:fc, :fcolor, :fcolour), |
src/components.jl
Outdated
| end aliases = Dict( | ||
| :yfill_color => (:fc, :fcolor, :fcolour,), | ||
| :yfill_alpha => (:falpha,), | ||
| :yfill_range => (:yfill_rng, :frange, :yfill_to, :yfill_between) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| :yfill_range => (:yfill_rng, :frange, :yfill_to, :yfill_between) | |
| :yfill_range => (:yfill_rng, :frange, :yfill_to, :yfill_between), |
| :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), |
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
|
| end | ||
|
|
||
| const _keyAliases = Dict{Symbol,Symbol}() | ||
| const _generalAliases = ("background" => "bg", "foreground" => "fg", "pointsize" => "size", "yfill" => "fill", "alpha" => "a", "alpha" => "opacity", "alpha" => "α", "errorbar" => "error") |
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" => "α", "errorbar" => "error") | |
| const _generalAliases = ( | |
| "background" => "bg", | |
| "foreground" => "fg", | |
| "pointsize" => "size", | |
| "yfill" => "fill", | |
| "alpha" => "a", | |
| "alpha" => "opacity", | |
| "alpha" => "α", | |
| "errorbar" => "error", | |
| ) |
src/components.jl
Outdated
| for letter in (:X, :Y, :Z) | ||
| ### Errorbars | ||
| @eval @add_attributes series struct $(Symbol(letter, :ErrorBar)) | ||
| marker::Marker = Marker(shape = getproperty(( X = :vline, Y = :hline, Z = :hline), letter)) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| marker::Marker = Marker(shape = getproperty(( X = :vline, Y = :hline, Z = :hline), letter)) | |
| marker::Marker = | |
| Marker(shape = getproperty((X = :vline, Y = :hline, Z = :hline), letter)) |
| alpha = nothing | ||
| style = nothing | ||
| end :aliases = Dict( | ||
| :yfill_color => (:fc, :fcolor, :fcolour,), |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| :yfill_color => (:fc, :fcolor, :fcolour,), | |
| :yfill_color => (:fc, :fcolor, :fcolour), |
| end :aliases = Dict( | ||
| :yfill_color => (:fc, :fcolor, :fcolour,), | ||
| :yfill_alpha => (:falpha,), | ||
| :yfill_range => (:yfill_rng, :frange, :yfill_to, :yfill_between) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| :yfill_range => (:yfill_rng, :frange, :yfill_to, :yfill_between) | |
| :yfill_range => (:yfill_rng, :frange, :yfill_to, :yfill_between), |
| :yfill_range => (:yfill_rng, :frange, :yfill_to, :yfill_between) | ||
| ) | ||
| end | ||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
I just wanted to implement the "more attributes" solution to #4476 and then one theng came to the other...
This is very early stage. It will reorganize the mentioned attributes to use the
@add_attributesmacro and therefore lots of internal names change (I apologize in advance, since this will break someones tests quite likely)It is also planned to go from just
filltox/y/zfillwhich will solve a remaining issue from #4164More info will follow once this progresses some more.
TODO
@add_attributescreate keyword constructor