Skip to content

Commit

Permalink
Revert "rename yfill -> fill"
Browse files Browse the repository at this point in the history
This reverts commit da25f97.
  • Loading branch information
BeastyBlacksmith committed Nov 10, 2022
1 parent 2ddf825 commit 0efda09
Show file tree
Hide file tree
Showing 19 changed files with 148 additions and 141 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:
- `(:yfill_range, :line_z, :marker_z, :marker_size, :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 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 `:yfill_range` and `zcolor` arguments (for example: `scatter(sin, 0:10, marker=15, fill=(cos,0.4), zcolor=sin)`)
- allow Function for `:fillrange` 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[:yfill_range] = nothing
plotattributes[:fillrange] = 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.",
: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.",
: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.",
: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",
:fillstyle => "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
45 changes: 26 additions & 19 deletions src/args.jl
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ 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 @@ -573,6 +577,7 @@ add_aliases(:right_margin, :rightmargin)

# colors
add_aliases(:seriescolor, :c, :color, :colour)
add_aliases(:fillcolor, :fc, :fcolor, :fcolour, :fillcolour)

add_aliases(
:background_color,
Expand Down Expand Up @@ -787,6 +792,7 @@ add_aliases(

# alphas
add_aliases(:seriesalpha, :alpha, , :opacity)
add_aliases(:fillalpha, :fa, :falpha, :fα, :fillopacity, :fopacity)

# axes attributes
add_axes_aliases(:guide, :label, :lab, :l; generic = false)
Expand Down Expand Up @@ -870,6 +876,7 @@ add_aliases(:marker, :m, :mark)
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(:group, :g, :grouping)
add_aliases(:bins, :bin, :nbin, :nbins, :nb)
add_aliases(:ribbon, :rib)
Expand Down Expand Up @@ -1084,13 +1091,13 @@ function processLineArg(plotattributes::AKW, arg)
arg.style === nothing || (plotattributes[:line_style] = arg.style)

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

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

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

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

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

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

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

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

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

# update alphas
for asym in (:line_alpha, :marker_alpha, :yfill_alpha)
for asym in (:line_alpha, :marker_alpha, :fillalpha)
if plotattributes[asym] === nothing
plotattributes[asym] = plotattributes[:seriesalpha]
end
Expand All @@ -2054,7 +2061,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_, :yfill_)
for s in (:line_, :marker_, :fill)
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 @@ -2086,7 +2093,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, :yfill_color, :yfill_alpha)
ensure_gradient!(plotattributes, :fillcolor, :fillalpha)
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 @@ -453,7 +453,7 @@ function expand_extrema!(sp::Subplot, plotattributes::AKW)
# end

# expand for fillrange
fr = plotattributes[:yfill_range]
fr = plotattributes[:fillrange]
if fr === nothing && plotattributes[:seriestype] === :bar
fr = 0.0
end
Expand Down Expand Up @@ -512,7 +512,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,
:yfill_range,
:yfill_color,
:yfill_alpha,
:yfill_style,
:fillrange,
:fillcolor,
:fillalpha,
:fillstyle,
: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,
:yfill_range,
:yfill_color,
:yfill_alpha,
:fillrange,
:fillcolor,
:fillalpha,
: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,
:yfill_range,
:yfill_color,
:yfill_alpha,
:fillrange,
:fillcolor,
:fillalpha,
: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,
:yfill_range,
:yfill_color,
:yfill_alpha,
:yfill_style,
:fillrange,
:fillcolor,
:fillalpha,
:fillstyle,
: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,
# :yfill_range, :yfill_color, :yfill_alpha,
# :fillrange, :fillcolor, :fillalpha,
# :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,
:yfill_range,
:yfill_color,
:yfill_alpha,
:fillrange,
:fillcolor,
:fillalpha,
: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?
:yfill_color,
:yfill_alpha, #:yfill_range,
:fillcolor,
:fillalpha, #:fillrange,
# :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,
:yfill_range,
:yfill_color,
:yfill_alpha,
:fillrange,
:fillcolor,
:fillalpha,
: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[:yfill_range] !== nothing
if plotattributes[:fillrange] !== nothing
push!(style, "forget plot")
push!(series_collection, pgf_fill_legend_hack(plotattributes, args))
else
kw[:legendentry] = plotattributes[:label]
if st === :shape # || plotattributes[:yfill_range] !== nothing
if st === :shape # || plotattributes[:fillrange] !== 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[:yfill_range] !== nothing && st !== :shape
if series[:fillrange] !== nothing && st !== :shape
push!(
series_collection,
pgf_fillrange_series(
series,
i,
_cycle(series[:yfill_range], rng),
_cycle(series[:fillrange], 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, :yfill_color, :line_color)
for col in (:marker_color, :fillcolor, :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 @@ -219,7 +219,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[:yfill_range], 1:length(x[rng]))
fr = _cycle(series[:fillrange], 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 @@ -293,7 +293,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[:yfill_range]
fr = series[:fillrange]
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
Loading

0 comments on commit 0efda09

Please sign in to comment.