Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor marker and line attributes #4505

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0985edb
add attributes via `@add_attributes`
BeastyBlacksmith Nov 1, 2022
d12b770
use kwdef in add_attributes
BeastyBlacksmith Nov 2, 2022
5dae3a3
complete marker attributes
BeastyBlacksmith Nov 2, 2022
69e839a
rename yfill -> fill
BeastyBlacksmith Nov 2, 2022
aadc7a4
add alias_dict to add_attributes
BeastyBlacksmith Nov 2, 2022
07aa435
add some tests
BeastyBlacksmith Nov 2, 2022
7925968
make aliases work
BeastyBlacksmith Nov 3, 2022
f931f7a
complete legend aliases
BeastyBlacksmith Nov 3, 2022
dd1f611
add aliases to plotattr
BeastyBlacksmith Nov 3, 2022
65fc04c
move aliases
BeastyBlacksmith Nov 3, 2022
2ddf825
remove fill and errorbar
BeastyBlacksmith Nov 10, 2022
0efda09
Revert "rename yfill -> fill"
BeastyBlacksmith Nov 10, 2022
62fee9b
fix docstrings
BeastyBlacksmith Nov 10, 2022
65fed0a
fix args test
BeastyBlacksmith Nov 10, 2022
f47764d
fix aliases, fill_z and filter compounds
BeastyBlacksmith Nov 10, 2022
719f4b0
cosmetics
BeastyBlacksmith Nov 11, 2022
38806ac
fix marker aliases in shapes
BeastyBlacksmith Nov 11, 2022
5e1bd5e
wrap attributes in Attributes
BeastyBlacksmith Jan 6, 2023
65116fb
move alias detection to DefaultDict
BeastyBlacksmith Jan 15, 2023
867afa0
add test
BeastyBlacksmith Mar 8, 2023
90bc39f
Merge remote-tracking branch 'origin/master' into bbs/marknline
BeastyBlacksmith Mar 9, 2023
bffd24d
make it precompile
BeastyBlacksmith Mar 9, 2023
6dfba96
harmonize funciton
BeastyBlacksmith Mar 9, 2023
f737e0f
fix tests
BeastyBlacksmith Mar 10, 2023
0150ad2
fix recipespipeline tests
BeastyBlacksmith Mar 10, 2023
75db4f3
Merge branch 'master' into bbs/marknline
BeastyBlacksmith Mar 10, 2023
c49da28
adlust benchmarks, revert macro test
BeastyBlacksmith Mar 10, 2023
33bae7f
don't dev Plots twice
BeastyBlacksmith Mar 10, 2023
7705f8a
format
BeastyBlacksmith Mar 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ Many updates, min julia 1.0
- allow calling `plot!(sp, ...)` to update a target Subplot
- PyPlot: zorder fix
- new DataFrames logic/recipe: more flexible/robust and allow Symbols for:
- `(:fillrange, :line_z, :marker_z, :markersize, :ribbon, :weights, :xerror, :yerror)`
- `(:fillrange, :line_z, :marker_z, :marker_size, :ribbon, :weights, :xerror, :yerror)`
- new `display_type` and `extra_kwargs` plot attributes
- surface fix

Expand Down
4 changes: 2 additions & 2 deletions RecipesBase/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ function RecipesBase.apply_recipe(d::Dict{Symbol,Any},::T,n=1)
end
series_list = RecipesBase.RecipeData[]
func_return = begin
get!(d,:markershape,:auto)
d[:markercolor] = customcolor
get!(d,:marker_shape,:auto)
d[:marker_color] = customcolor
get!(d,:xrotation,45)
get!(d,:zrotation,90)
rand(10,n)
Expand Down
32 changes: 16 additions & 16 deletions RecipesBase/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ end
n::N = 1;
customcolor = :green,
) where {N<:Integer}
:markershape --> :auto, :require
:markercolor --> customcolor, :force
:marker_shape --> :auto, :require
:marker_color --> customcolor, :force
:xrotation --> 5
:zrotation --> 6, :quiet
rand(StableRNG(1), 10, n)
Expand All @@ -77,8 +77,8 @@ end
T1,
KW(
:customcolor => :red,
:markershape => :auto,
:markercolor => :red,
:marker_shape => :auto,
:marker_color => :red,
:xrotation => 5,
:zrotation => 6,
),
Expand All @@ -93,8 +93,8 @@ end
n::N = 1;
customcolor = :green,
) where {N<:Integer}
:markershape --> :auto, :require
:markercolor --> customcolor, :force
:marker_shape --> :auto, :require
:marker_color --> customcolor, :force
:xrotation --> 5
:zrotation --> 6, :quiet
rand(StableRNG(1), 10, n)
Expand All @@ -104,8 +104,8 @@ end
T2,
KW(
:customcolor => :red,
:markershape => :auto,
:markercolor => :red,
:marker_shape => :auto,
:marker_color => :red,
:xrotation => 5,
:zrotation => 6,
),
Expand All @@ -121,8 +121,8 @@ end
m::M = 0.0;
customcolor = :green,
) where {N<:Integer} where {M<:Float64}
:markershape --> :auto, :require
:markercolor --> customcolor, :force
:marker_shape --> :auto, :require
:marker_color --> customcolor, :force
:xrotation --> 5
:zrotation --> 6, :quiet
rand(StableRNG(1), 10, n)
Expand All @@ -132,8 +132,8 @@ end
T3,
KW(
:customcolor => :red,
:markershape => :auto,
:markercolor => :red,
:marker_shape => :auto,
:marker_color => :red,
:xrotation => 5,
:zrotation => 6,
),
Expand All @@ -144,8 +144,8 @@ end
@test_throws MethodError RecipesBase.apply_recipe(KW(), T4())

RecipesBase.@recipe function plot(t::T4, n = 1; customcolor = :green)
:markershape --> :auto, :require
:markercolor --> customcolor, :force
:marker_shape --> :auto, :require
:marker_color --> customcolor, :force
:xrotation --> 5
:zrotation --> 6, :quiet
plotattributes[:hello] = "hi"
Expand All @@ -156,8 +156,8 @@ end
T4,
KW(
:customcolor => :red,
:markershape => :auto,
:markercolor => :red,
:marker_shape => :auto,
:marker_color => :red,
:xrotation => 5,
:zrotation => 6,
:hello => "hi",
Expand Down
1 change: 0 additions & 1 deletion src/Plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import RecipesPipeline:
timeformatter,
needs_3d_axes,
DefaultsDict,
explicitkeys,
scale_func,
is_surface,
Formatted,
Expand Down
26 changes: 13 additions & 13 deletions src/arg_desc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ const _arg_desc = KW(
:seriescolor => "Color Type. The base color for this series. `:auto` (the default) will select a color from the subplot's `color_palette`, based on the order it was added to the subplot",
:seriesalpha => "Number in [0,1]. The alpha/opacity override for the series. `nothing` (the default) means it will take the alpha value of the color.",
:seriestype => "Symbol. This is the identifier of the type of visualization for this series. Choose from $(_allTypes) or any series recipes which are defined.",
:linestyle => "Symbol. Style of the line (for path and bar stroke). Choose from $(_allStyles)",
:linewidth => "Number. Width of the line (in pixels)",
:linecolor => "Color Type. Color of the line (for path and bar stroke). `:match` will take the value from `:seriescolor`, (though histogram/bar types use `:black` as a default).",
:linealpha => "Number in [0,1]. The alpha/opacity override for the line. `nothing` (the default) means it will take the alpha value of linecolor.",
:line_style => "Symbol. Style of the line (for path and bar stroke). Choose from $(_allStyles)",
:line_width => "Number. Width of the line (in pixels)",
:line_color => "Color Type. Color of the line (for path and bar stroke). `:match` will take the value from `:seriescolor`, (though histogram/bar types use `:black` as a default).",
:line_alpha => "Number in [0,1]. The alpha/opacity override for the line. `nothing` (the default) means it will take the alpha value of linecolor.",
: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.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
: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.",

: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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
: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",

:markercolor => "Color Type. Color of the interior of the marker or shape. `:match` will take the value from `:seriescolor`.",
:markeralpha => "Number in [0,1]. The alpha/opacity override for the marker interior. `nothing` (the default) means it will take the alpha value of markercolor.",
:markersize => "Number or AbstractVector. Size (radius pixels) of the markers",
:markerstrokestyle => "Symbol. Style of the marker stroke (border). Choose from $(_allStyles)",
:markerstrokewidth => "Number. Width of the marker stroke (border) in pixels",
:markerstrokecolor => "Color Type. Color of the marker stroke (border). `:match` will take the value from `:foreground_color_subplot`.",
:markerstrokealpha => "Number in [0,1]. The alpha/opacity override for the marker stroke (border). `nothing` (the default) means it will take the alpha value of markerstrokecolor.",
:marker_color => "Color Type. Color of the interior of the marker or shape. `:match` will take the value from `:seriescolor`.",
:marker_alpha => "Number in [0,1]. The alpha/opacity override for the marker interior. `nothing` (the default) means it will take the alpha value of markercolor.",
:marker_size => "Number or AbstractVector. Size (radius pixels) of the markers",
:marker_stroke_style => "Symbol. Style of the marker stroke (border). Choose from $(_allStyles)",
:marker_stroke_width => "Number. Width of the marker stroke (border) in pixels",
:marker_stroke_color => "Color Type. Color of the marker stroke (border). `:match` will take the value from `:foreground_color_subplot`.",
:marker_stroke_alpha => "Number in [0,1]. The alpha/opacity override for the marker stroke (border). `nothing` (the default) means it will take the alpha value of markerstrokecolor.",
:bins => "Integer, NTuple{2,Integer}, AbstractVector or Symbol. Default is :auto (the Freedman-Diaconis rule). For histogram-types, defines the approximate number of bins to aim for, or the auto-binning algorithm to use (:sturges, :sqrt, :rice, :scott or :fd). For fine-grained control pass a Vector of break values, e.g. `range(minimum(x), stop = maximum(x), length = 25)`",
:smooth => "Bool. Add a regression line?",
:group => "AbstractVector. Data is split into a separate series, one for each unique value in `group`",
Expand Down Expand Up @@ -187,7 +187,7 @@ const _arg_desc = KW(
:showaxis => "Bool, Symbol or String. Show the axis. `true`, `false`, `:show`, `:hide`, `:yes`, `:no`, `:x`, `:y`, `:z`, `:xy`, ..., `:all`, `:off`",
:widen => """
Bool, Number or :auto. Widen the axis limits by a small factor to avoid cut-off markers and lines at the borders.
If set to `true`, scale the axis limits by the default factor of $(default_widen_factor).
If set to `true`, scale the axis limits by the default factor of $(default_widen_factor).
A different factor may be specified by setting `widen` to a number.
Defaults to `:auto`, which widens by the default factor unless limits were manually set.
See also the `scale_limits!` function for scaling axis limits in an existing plot.
Expand Down