Skip to content

Commit

Permalink
rename yfill -> fill
Browse files Browse the repository at this point in the history
  • Loading branch information
BeastyBlacksmith committed Nov 2, 2022
1 parent b69d472 commit da25f97
Show file tree
Hide file tree
Showing 19 changed files with 148 additions and 152 deletions.
4 changes: 2 additions & 2 deletions 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, :marker_size, :ribbon, :weights, :xerror, :yerror)`
- `(:yfill_range, :line_z, :marker_z, :marker_size, :ribbon, :weights, :xerror, :yerror)`
- new `display_type` and `extra_kwargs` plot attributes
- surface fix

Expand Down Expand Up @@ -808,7 +808,7 @@ Many updates, min julia 1.0
- New dependency on Requires, allows auto-loading of DataFrames support
- Support for plotting lists of Tuples and FixedSizeArrays
- new `@animate` macro for super simple animations (see https://github.com/tbreloff/Plots.jl/issues/111#issuecomment-181515616)
- allow Function for `:fillrange` and `zcolor` arguments (for example: `scatter(sin, 0:10, marker=15, fill=(cos,0.4), zcolor=sin)`)
- allow Function for `:yfill_range` and `zcolor` arguments (for example: `scatter(sin, 0:10, marker=15, fill=(cos,0.4), zcolor=sin)`)
- allow vectors of PlotText without x/y coords (for example: `scatter(rand(10), m=20, ann=map(text, 1:10))`)
- Lots and lots of fixes

Expand Down
2 changes: 1 addition & 1 deletion RecipesPipeline/src/series_recipe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function _process_seriesrecipe(plt, plotattributes)

# shapes shouldn't have fillrange set
if plotattributes[:seriestype] == :shape
plotattributes[:fillrange] = nothing
plotattributes[:yfill_range] = nothing
end

# if it's natively supported, finalize processing and pass along to the backend,
Expand Down
8 changes: 4 additions & 4 deletions src/arg_desc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const _arg_desc = KW(
: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.",
: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.",
: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",
:yfill_style => "Symbol. Style of the fill area. `nothing` (the default) means solid fill. Choose from :/, :\\, :|, :-, :+, :x",
: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",
Expand Down
48 changes: 22 additions & 26 deletions src/args.jl
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,6 @@ const _series_defaults = KW(
:seriescolor => :auto,
:seriesalpha => nothing,
:seriestype => :path,
:fillrange => nothing, # ribbons, areas, etc
:fillcolor => :match,
:fillalpha => nothing,
:fillstyle => nothing,
:bins => :auto, # number of bins for hists
:smooth => false, # regression line?
:group => nothing, # groupby vector
Expand Down Expand Up @@ -600,7 +596,7 @@ add_aliases(:line_color, :lc, :lcolor, :lcolour, :linecolour)
add_aliases(:marker_color, :mc, :mcolor, :mcolour, :markercolour)
add_aliases(:marker_stroke_color, :msc, :mscolor, :mscolour, :markerstrokecolour)
add_aliases(:marker_stroke_width, :msw, :mswidth)
add_aliases(:fillcolor, :fc, :fcolor, :fcolour, :fillcolour)
add_aliases(:yfill_color, :fc, :fcolor, :fcolour, :fillcolour)

add_aliases(
:background_color,
Expand Down Expand Up @@ -818,7 +814,7 @@ add_aliases(:seriesalpha, :alpha, :α, :opacity)
add_aliases(:line_alpha, :la, :lalpha, :lα, :lineopacity, :lopacity)
add_aliases(:marker_alpha, :ma, :malpha, :mα, :markeropacity, :mopacity)
add_aliases(:marker_stroke_alpha, :msa, :msalpha, :msα, :markerstrokeopacity, :msopacity)
add_aliases(:fillalpha, :fa, :falpha, :fα, :fillopacity, :fopacity)
add_aliases(:yfill_alpha, :fa, :falpha, :fα, :fillopacity, :fopacity)

# axes attributes
add_axes_aliases(:guide, :label, :lab, :l; generic = false)
Expand Down Expand Up @@ -906,7 +902,7 @@ add_aliases(:marker_size, :ms, :msize)
add_aliases(:marker_z, :markerz, :zcolor, :mz)
add_aliases(:line_z, :linez, :zline, :lz)
add_aliases(:fill, :f, :area)
add_aliases(:fillrange, :fillrng, :frange, :fillto, :fill_between)
add_aliases(:yfill_range, :fillrng, :frange, :fillto, :fill_between)
add_aliases(:group, :g, :grouping)
add_aliases(:bins, :bin, :nbin, :nbins, :nb)
add_aliases(:ribbon, :rib)
Expand Down Expand Up @@ -1121,13 +1117,13 @@ function processLineArg(plotattributes::AKW, arg)
arg.style === nothing || (plotattributes[:line_style] = arg.style)

elseif typeof(arg) <: Brush
arg.size === nothing || (plotattributes[:fillrange] = arg.size)
arg.size === nothing || (plotattributes[:yfill_range] = arg.size)
arg.color === nothing || (
plotattributes[:fillcolor] =
plotattributes[:yfill_color] =
arg.color === :auto ? :auto : plot_color(arg.color)
)
arg.alpha === nothing || (plotattributes[:fillalpha] = arg.alpha)
arg.style === nothing || (plotattributes[:fillstyle] = arg.style)
arg.alpha === nothing || (plotattributes[:yfill_alpha] = arg.alpha)
arg.style === nothing || (plotattributes[:yfill_style] = arg.style)

elseif typeof(arg) <: Arrow || arg in (:arrow, :arrows)
plotattributes[:arrow] = arg
Expand Down Expand Up @@ -1191,35 +1187,35 @@ function processMarkerArg(plotattributes::AKW, arg)
end

function processFillArg(plotattributes::AKW, arg)
# fr = get(plotattributes, :fillrange, 0)
# fr = get(plotattributes, :yfill_range, 0)
if typeof(arg) <: Brush
arg.size === nothing || (plotattributes[:fillrange] = arg.size)
arg.size === nothing || (plotattributes[:yfill_range] = arg.size)
arg.color === nothing || (
plotattributes[:fillcolor] =
plotattributes[:yfill_color] =
arg.color === :auto ? :auto : plot_color(arg.color)
)
arg.alpha === nothing || (plotattributes[:fillalpha] = arg.alpha)
arg.style === nothing || (plotattributes[:fillstyle] = arg.style)
arg.alpha === nothing || (plotattributes[:yfill_alpha] = arg.alpha)
arg.style === nothing || (plotattributes[:yfill_style] = arg.style)

elseif typeof(arg) <: Bool
plotattributes[:fillrange] = arg ? 0 : nothing
plotattributes[:yfill_range] = arg ? 0 : nothing

# fillrange function
elseif allFunctions(arg)
plotattributes[:fillrange] = arg
plotattributes[:yfill_range] = arg

# fillalpha
elseif allAlphas(arg)
plotattributes[:fillalpha] = arg
plotattributes[:yfill_alpha] = arg

# fillrange provided as vector or number
elseif typeof(arg) <: Union{AbstractArray{<:Real},Real}
plotattributes[:fillrange] = arg
plotattributes[:yfill_range] = arg

elseif !handleColors!(plotattributes, arg, :fillcolor)
plotattributes[:fillrange] = arg
elseif !handleColors!(plotattributes, arg, :yfill_color)
plotattributes[:yfill_range] = arg
end
# plotattributes[:fillrange] = fr
# plotattributes[:yfill_range] = fr
nothing
end

Expand Down Expand Up @@ -2084,7 +2080,7 @@ function _update_series_attributes!(plotattributes::AKW, plt::Plot, sp::Subplot)
)

# update alphas
for asym in (:line_alpha, :marker_alpha, :fillalpha)
for asym in (:line_alpha, :marker_alpha, :yfill_alpha)
if plotattributes[asym] === nothing
plotattributes[asym] = plotattributes[:seriesalpha]
end
Expand All @@ -2099,7 +2095,7 @@ function _update_series_attributes!(plotattributes::AKW, plt::Plot, sp::Subplot)
plotattributes[:seriescolor] = scolor = get_series_color(scolor, sp, plotIndex, stype)

# update other colors
for s in (:line_, :marker_, :fill)
for s in (:line_, :marker_, :yfill_)
csym, asym = Symbol(s, :color), Symbol(s, :alpha)
plotattributes[csym] = if plotattributes[csym] === :auto
plot_color(if has_black_border_for_default(stype) && s === :line
Expand Down Expand Up @@ -2131,7 +2127,7 @@ function _update_series_attributes!(plotattributes::AKW, plt::Plot, sp::Subplot)
ensure_gradient!(plotattributes, :line_color, :line_alpha)
end
if plotattributes[:fill_z] !== nothing
ensure_gradient!(plotattributes, :fillcolor, :fillalpha)
ensure_gradient!(plotattributes, :yfill_color, :yfill_alpha)
end

# scatter plots don't have a line, but must have a shape
Expand Down
4 changes: 2 additions & 2 deletions src/axes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ function expand_extrema!(sp::Subplot, plotattributes::AKW)
# end

# expand for fillrange
fr = plotattributes[:fillrange]
fr = plotattributes[:yfill_range]
if fr === nothing && plotattributes[:seriestype] === :bar
fr = 0.0
end
Expand Down Expand Up @@ -514,7 +514,7 @@ end
scale_lims!([plt], [letter], factor)
Scale the limits of the axis specified by `letter` (one of `:x`, `:y`, `:z`) by the
given `factor` around the limits' middle point.
given `factor` around the limits' middle point.
If `letter` is omitted, all axes are affected.
"""
function scale_lims!(sp::Subplot, letter, factor)
Expand Down
46 changes: 23 additions & 23 deletions src/backends.jl
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,10 @@ const _gr_attr = merge_with_base_supported([
:marker_stroke_width,
:marker_stroke_color,
:marker_stroke_alpha,
:fillrange,
:fillcolor,
:fillalpha,
:fillstyle,
:yfill_range,
:yfill_color,
:yfill_alpha,
:yfill_style,
:bins,
:layout,
:title,
Expand Down Expand Up @@ -448,9 +448,9 @@ const _plotly_attr = merge_with_base_supported([
:marker_stroke_color,
:marker_stroke_alpha,
:marker_stroke_style,
:fillrange,
:fillcolor,
:fillalpha,
:yfill_range,
:yfill_color,
:yfill_alpha,
:bins,
:title,
:titlelocation,
Expand Down Expand Up @@ -573,9 +573,9 @@ const _pgfplots_attr = merge_with_base_supported([
:marker_stroke_color,
:marker_stroke_alpha,
:marker_stroke_style,
:fillrange,
:fillcolor,
:fillalpha,
:yfill_range,
:yfill_color,
:yfill_alpha,
:bins,
# :bar_width, :bar_edges,
:title,
Expand Down Expand Up @@ -687,10 +687,10 @@ const _pyplot_attr = merge_with_base_supported([
:marker_stroke_width,
:marker_stroke_color,
:marker_stroke_alpha,
:fillrange,
:fillcolor,
:fillalpha,
:fillstyle,
:yfill_range,
:yfill_color,
:yfill_alpha,
:yfill_style,
:bins,
:bar_width,
:bar_edges,
Expand Down Expand Up @@ -806,7 +806,7 @@ const _gaston_attr = merge_with_base_supported([
:marker_size,
:marker_alpha,
# :marker_stroke_width, :marker_stroke_color, :marker_stroke_alpha, :marker_stroke_style,
# :fillrange, :fillcolor, :fillalpha,
# :yfill_range, :yfill_color, :yfill_alpha,
# :bins,
# :bar_width, :bar_edges,
:title,
Expand Down Expand Up @@ -988,9 +988,9 @@ const _hdf5_attr = merge_with_base_supported([
:marker_stroke_width,
:marker_stroke_color,
:marker_stroke_alpha,
:fillrange,
:fillcolor,
:fillalpha,
:yfill_range,
:yfill_color,
:yfill_alpha,
:bins,
:bar_width,
:bar_edges,
Expand Down Expand Up @@ -1094,8 +1094,8 @@ const _inspectdr_attr = merge_with_base_supported([
:marker_stroke_color,
:marker_stroke_alpha,
:marker_stroke_style, #Causes warning not to have it... what is this?
:fillcolor,
:fillalpha, #:fillrange,
:yfill_color,
:yfill_alpha, #:yfill_range,
# :bins, :bar_width, :bar_edges, :bar_position,
:title,
:titlelocation,
Expand Down Expand Up @@ -1195,9 +1195,9 @@ const _pgfplotsx_attr = merge_with_base_supported([
:marker_stroke_width,
:marker_stroke_color,
:marker_stroke_alpha,
:fillrange,
:fillcolor,
:fillalpha,
:yfill_range,
:yfill_color,
:yfill_alpha,
:bins,
:layout,
:title,
Expand Down
10 changes: 5 additions & 5 deletions src/backends/deprecated/pgfplots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ function pgf_series(sp::Subplot, series::Series)

# add to legend?
if i == 1 && sp[:legend_position] !== :none && should_add_to_legend(series)
if plotattributes[:fillrange] !== nothing
if plotattributes[:yfill_range] !== nothing
push!(style, "forget plot")
push!(series_collection, pgf_fill_legend_hack(plotattributes, args))
else
kw[:legendentry] = plotattributes[:label]
if st === :shape # || plotattributes[:fillrange] !== nothing
if st === :shape # || plotattributes[:yfill_range] !== nothing
push!(style, "area legend")
end
end
Expand All @@ -247,13 +247,13 @@ function pgf_series(sp::Subplot, series::Series)
kw[:style] = join(style, ',')

# add fillrange
if series[:fillrange] !== nothing && st !== :shape
if series[:yfill_range] !== nothing && st !== :shape
push!(
series_collection,
pgf_fillrange_series(
series,
i,
_cycle(series[:fillrange], rng),
_cycle(series[:yfill_range], rng),
seg_args...,
),
)
Expand Down Expand Up @@ -641,7 +641,7 @@ function _update_plot_object(plt::Plot{PGFPlotsBackend})
# As it is likely that all series within the same axis use the same
# colormap this should not cause any problem.
for series in series_list(sp)
for col in (:marker_color, :fillcolor, :line_color)
for col in (:marker_color, :yfill_color, :line_color)
if typeof(series.plotattributes[col]) == ColorGradient
push!(
style,
Expand Down
4 changes: 2 additions & 2 deletions src/backends/gaston.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ function gaston_add_series(plt::Plot{GastonBackend}, series::Series)
if gsp.dims == 2 && z === nothing
for (n, seg) in enumerate(series_segments(series, st; check = true))
i, rng = seg.attr_index, seg.range
fr = _cycle(series[:fillrange], 1:length(x[rng]))
fr = _cycle(series[:yfill_range], 1:length(x[rng]))
for sc in gaston_seriesconf!(sp, series, i, n == 1)
push!(curves, Gaston.Curve(x[rng], y[rng], nothing, fr, sc))
end
Expand Down Expand Up @@ -296,7 +296,7 @@ function gaston_seriesconf!(
pt, ps, mc = gaston_mk_ms_mc(series, clims, i)
push!(curveconf, "w points pt $pt ps $ps lc $mc")
elseif st (:path, :straightline, :path3d)
fr = series[:fillrange]
fr = series[:yfill_range]
fc = gaston_color(get_fillcolor(series, i), get_fillalpha(series, i))
fs = get_fillstyle(series, i) # FIXME: add fillstyle support ?
lc, dt, lw = gaston_lc_ls_lw(series, clims, i)
Expand Down

0 comments on commit da25f97

Please sign in to comment.