be explicit about RecipesPipeline imports

This commit is contained in:
Daniel Schwabeneder 2020-04-10 19:06:53 +02:00
parent 7d69795364
commit 4c43f0ea2f
15 changed files with 87 additions and 89 deletions

View File

@ -177,7 +177,7 @@ import RecipesPipeline: SliceIt,
is3d,
is_surface,
needs_3d_axes,
group_as_matrix,
group_as_matrix, # for StatsPlots
reset_kw!,
pop_kw!,
scale_func,

View File

@ -86,10 +86,10 @@ const _surface_like = [:contour, :contourf, :contour3d, :heatmap, :surface, :wir
like_histogram(seriestype::Symbol) = seriestype in _histogram_like
like_line(seriestype::Symbol) = seriestype in _line_like
like_surface(seriestype::Symbol) = is_surface(seriestype)
like_surface(seriestype::Symbol) = RecipesPipeline.is_surface(seriestype)
is3d(series::Series) = is3d(series.plotattributes)
is3d(sp::Subplot) = string(sp.attr[:projection]) == "3d"
RecipesPipeline.is3d(series::Series) = RecipesPipeline.is3d(series.plotattributes)
RecipesPipeline.is3d(sp::Subplot) = string(sp.attr[:projection]) == "3d"
ispolar(sp::Subplot) = string(sp.attr[:projection]) == "polar"
ispolar(series::Series) = ispolar(series.plotattributes[:subplot])
@ -682,7 +682,7 @@ end
function default(; kw...)
kw = KW(kw)
preprocess_attributes!(kw)
RecipesPipeline.preprocess_attributes!(kw)
for (k,v) in kw
default(k, v)
end
@ -935,11 +935,11 @@ function _add_markershape(plotattributes::AKW)
end
"Handle all preprocessing of args... break out colors/sizes/etc and replace aliases."
function preprocess_attributes!(plotattributes::AKW)
function RecipesPipeline.preprocess_attributes!(plotattributes::AKW)
replaceAliases!(plotattributes, _keyAliases)
# handle axis args common to all axis
args = pop_kw!(plotattributes, :axis, ())
args = RecipesPipeline.pop_kw!(plotattributes, :axis, ())
for arg in wraptuple(args)
for letter in (:x, :y, :z)
process_axis_arg!(plotattributes, arg, letter)
@ -948,7 +948,7 @@ function preprocess_attributes!(plotattributes::AKW)
# handle axis args
for letter in (:x, :y, :z)
asym = Symbol(letter, :axis)
args = pop_kw!(plotattributes, asym, ())
args = RecipesPipeline.pop_kw!(plotattributes, asym, ())
if !(typeof(args) <: Axis)
for arg in wraptuple(args)
process_axis_arg!(plotattributes, arg, letter)
@ -966,7 +966,7 @@ function preprocess_attributes!(plotattributes::AKW)
end
# handle grid args common to all axes
args = pop_kw!(plotattributes, :grid, ())
args = RecipesPipeline.pop_kw!(plotattributes, :grid, ())
for arg in wraptuple(args)
for letter in (:x, :y, :z)
processGridArg!(plotattributes, arg, letter)
@ -975,13 +975,13 @@ function preprocess_attributes!(plotattributes::AKW)
# handle individual axes grid args
for letter in (:x, :y, :z)
gridsym = Symbol(letter, :grid)
args = pop_kw!(plotattributes, gridsym, ())
args = RecipesPipeline.pop_kw!(plotattributes, gridsym, ())
for arg in wraptuple(args)
processGridArg!(plotattributes, arg, letter)
end
end
# handle minor grid args common to all axes
args = pop_kw!(plotattributes, :minorgrid, ())
args = RecipesPipeline.pop_kw!(plotattributes, :minorgrid, ())
for arg in wraptuple(args)
for letter in (:x, :y, :z)
processMinorGridArg!(plotattributes, arg, letter)
@ -990,14 +990,14 @@ function preprocess_attributes!(plotattributes::AKW)
# handle individual axes grid args
for letter in (:x, :y, :z)
gridsym = Symbol(letter, :minorgrid)
args = pop_kw!(plotattributes, gridsym, ())
args = RecipesPipeline.pop_kw!(plotattributes, gridsym, ())
for arg in wraptuple(args)
processMinorGridArg!(plotattributes, arg, letter)
end
end
# handle font args common to all axes
for fontname in (:tickfont, :guidefont)
args = pop_kw!(plotattributes, fontname, ())
args = RecipesPipeline.pop_kw!(plotattributes, fontname, ())
for arg in wraptuple(args)
for letter in (:x, :y, :z)
processFontArg!(plotattributes, Symbol(letter, fontname), arg)
@ -1007,7 +1007,7 @@ function preprocess_attributes!(plotattributes::AKW)
# handle individual axes font args
for letter in (:x, :y, :z)
for fontname in (:tickfont, :guidefont)
args = pop_kw!(plotattributes, Symbol(letter, fontname), ())
args = RecipesPipeline.pop_kw!(plotattributes, Symbol(letter, fontname), ())
for arg in wraptuple(args)
processFontArg!(plotattributes, Symbol(letter, fontname), arg)
end
@ -1028,14 +1028,14 @@ function preprocess_attributes!(plotattributes::AKW)
# fonts
for fontname in (:titlefont, :legendfont, :legendtitlefont)
args = pop_kw!(plotattributes, fontname, ())
args = RecipesPipeline.pop_kw!(plotattributes, fontname, ())
for arg in wraptuple(args)
processFontArg!(plotattributes, fontname, arg)
end
end
# handle line args
for arg in wraptuple(pop_kw!(plotattributes, :line, ()))
for arg in wraptuple(RecipesPipeline.pop_kw!(plotattributes, :line, ()))
processLineArg(plotattributes, arg)
end
@ -1049,7 +1049,7 @@ function preprocess_attributes!(plotattributes::AKW)
processMarkerArg(plotattributes, arg)
anymarker = true
end
reset_kw!(plotattributes, :marker)
RecipesPipeline.reset_kw!(plotattributes, :marker)
if haskey(plotattributes, :markershape)
plotattributes[:markershape] = _replace_markershape(plotattributes[:markershape])
if plotattributes[:markershape] == :none && plotattributes[:seriestype] in (:scatter, :scatterbins, :scatterhist, :scatter3d) #the default should be :auto, not :none, so that :none can be set explicitly and would be respected
@ -1063,7 +1063,7 @@ function preprocess_attributes!(plotattributes::AKW)
for arg in wraptuple(get(plotattributes, :fill, ()))
processFillArg(plotattributes, arg)
end
reset_kw!(plotattributes, :fill)
RecipesPipeline.reset_kw!(plotattributes, :fill)
# handle series annotations
if haskey(plotattributes, :series_annotations)
@ -1212,7 +1212,7 @@ function slice_arg!(plotattributes_in, plotattributes_out,
v
end
if remove_pair
reset_kw!(plotattributes_in, k)
RecipesPipeline.reset_kw!(plotattributes_in, k)
end
return
end
@ -1473,7 +1473,7 @@ end
# update a subplots args and axes
function _update_subplot_args(plt::Plot, sp::Subplot, plotattributes_in, subplot_index::Int, remove_pair::Bool)
anns = pop_kw!(sp.attr, :annotations)
anns = RecipesPipeline.pop_kw!(sp.attr, :annotations)
# # grab those args which apply to this subplot
for k in keys(_subplot_defaults)

View File

@ -85,7 +85,7 @@ function attr!(axis::Axis, args...; kw...)
end
# then preprocess keyword arguments
preprocess_attributes!(KW(kw))
RecipesPipeline.preprocess_attributes!(KW(kw))
# then override for any keywords... only those keywords that already exists in plotattributes
for (k,v) in kw
@ -129,7 +129,7 @@ function optimal_ticks_and_labels(sp::Subplot, axis::Axis, ticks = nothing)
# scale the limits
scale = axis[:scale]
sf = scale_func(scale)
sf = RecipesPipeline.scale_func(scale)
# If the axis input was a Date or DateTime use a special logic to find
# "round" Date(Time)s as ticks
@ -174,11 +174,11 @@ function optimal_ticks_and_labels(sp::Subplot, axis::Axis, ticks = nothing)
# chosen ticks is not too much bigger than amin - amax:
strict_span = false,
)
axis[:lims] = map(inverse_scale_func(scale), (viewmin, viewmax))
axis[:lims] = map(RecipesPipeline.inverse_scale_func(scale), (viewmin, viewmax))
else
scaled_ticks = map(sf, (filter(t -> amin <= t <= amax, ticks)))
end
unscaled_ticks = map(inverse_scale_func(scale), scaled_ticks)
unscaled_ticks = map(RecipesPipeline.inverse_scale_func(scale), scaled_ticks)
labels = if any(isfinite, unscaled_ticks)
formatter = axis[:formatter]
@ -378,7 +378,7 @@ function expand_extrema!(sp::Subplot, plotattributes::AKW)
if fr === nothing && plotattributes[:seriestype] == :bar
fr = 0.0
end
if fr !== nothing && !is3d(plotattributes)
if fr !== nothing && !RecipesPipeline.is3d(plotattributes)
axis = sp.attr[vert ? :yaxis : :xaxis]
if typeof(fr) <: Tuple
for fri in fr
@ -423,7 +423,7 @@ end
# push the limits out slightly
function widen(lmin, lmax, scale = :identity)
f, invf = scale_func(scale), inverse_scale_func(scale)
f, invf = RecipesPipeline.scale_func(scale), RecipesPipeline.inverse_scale_func(scale)
span = f(lmax) - f(lmin)
# eps = NaNMath.max(1e-16, min(1e-2span, 1e-10))
eps = NaNMath.max(1e-16, 0.03span)
@ -492,7 +492,7 @@ function axis_limits(sp, letter, should_widen = default_should_widen(sp[Symbol(l
amin, amax
end
if !has_user_lims && consider_aspect && letter in (:x, :y) && !(sp[:aspect_ratio] in (:none, :auto) || is3d(:sp))
if !has_user_lims && consider_aspect && letter in (:x, :y) && !(sp[:aspect_ratio] in (:none, :auto) || RecipesPipeline.is3d(:sp))
aspect_ratio = isa(sp[:aspect_ratio], Number) ? sp[:aspect_ratio] : 1
plot_ratio = height(plotarea(sp)) / width(plotarea(sp))
dist = amax - amin
@ -626,8 +626,8 @@ function axis_drawing_info(sp::Subplot)
sp[:framestyle] in (:semi, :box) && push!(xborder_segs, (xmin, y2), (xmax, y2)) # top spine
end
if !(xaxis[:ticks] in (:none, nothing, false))
f = scale_func(yaxis[:scale])
invf = inverse_scale_func(yaxis[:scale])
f = RecipesPipeline.scale_func(yaxis[:scale])
invf = RecipesPipeline.inverse_scale_func(yaxis[:scale])
tick_start, tick_stop = if sp[:framestyle] == :origin
t = invf(f(0) + 0.012 * (f(ymax) - f(ymin)))
(-t, t)
@ -680,8 +680,8 @@ function axis_drawing_info(sp::Subplot)
sp[:framestyle] in (:semi, :box) && push!(yborder_segs, (x2, ymin), (x2, ymax)) # right spine
end
if !(yaxis[:ticks] in (:none, nothing, false))
f = scale_func(xaxis[:scale])
invf = inverse_scale_func(xaxis[:scale])
f = RecipesPipeline.scale_func(xaxis[:scale])
invf = RecipesPipeline.inverse_scale_func(xaxis[:scale])
tick_start, tick_stop = if sp[:framestyle] == :origin
t = invf(f(0) + 0.012 * (f(xmax) - f(xmin)))
(-t, t)
@ -772,8 +772,8 @@ function axis_drawing_info_3d(sp::Subplot)
sp[:framestyle] in (:semi, :box) && push!(xborder_segs, (xmin, y2, z2), (xmax, y2, z2)) # top spine
end
if !(xaxis[:ticks] in (:none, nothing, false))
f = scale_func(yaxis[:scale])
invf = inverse_scale_func(yaxis[:scale])
f = RecipesPipeline.scale_func(yaxis[:scale])
invf = RecipesPipeline.inverse_scale_func(yaxis[:scale])
tick_start, tick_stop = if sp[:framestyle] == :origin
t = invf(f(0) + 0.012 * (f(ymax) - f(ymin)))
(-t, t)
@ -847,8 +847,8 @@ function axis_drawing_info_3d(sp::Subplot)
sp[:framestyle] in (:semi, :box) && push!(yborder_segs, (x2, ymin, z2), (x2, ymax, z2)) # right spine
end
if !(yaxis[:ticks] in (:none, nothing, false))
f = scale_func(xaxis[:scale])
invf = inverse_scale_func(xaxis[:scale])
f = RecipesPipeline.scale_func(xaxis[:scale])
invf = RecipesPipeline.inverse_scale_func(xaxis[:scale])
tick_start, tick_stop = if sp[:framestyle] == :origin
t = invf(f(0) + 0.012 * (f(xmax) - f(xmin)))
(-t, t)
@ -922,8 +922,8 @@ function axis_drawing_info_3d(sp::Subplot)
sp[:framestyle] in (:semi, :box) && push!(zborder_segs, (x2, y2, zmin), (x2, y2, zmax))
end
if !(zaxis[:ticks] in (:none, nothing, false))
f = scale_func(xaxis[:scale])
invf = inverse_scale_func(xaxis[:scale])
f = RecipesPipeline.scale_func(xaxis[:scale])
invf = RecipesPipeline.inverse_scale_func(xaxis[:scale])
tick_start, tick_stop = if sp[:framestyle] == :origin
t = invf(f(0) + 0.012 * (f(ymax) - f(ymin)))
(-t, t)

View File

@ -104,7 +104,7 @@ end
# Set the (left, top, right, bottom) minimum padding around the plot area
# to fit ticks, tick labels, guides, colorbars, etc.
function _update_min_padding!(sp::Subplot)
# TODO: something different when `is3d(sp) == true`
# TODO: something different when `RecipesPipeline.is3d(sp) == true`
leftpad = tick_padding(sp, sp[:yaxis]) + sp[:left_margin] + guide_padding(sp[:yaxis])
toppad = sp[:top_margin] + title_padding(sp)
rightpad = sp[:right_margin]

View File

@ -428,7 +428,7 @@ function gr_viewport_from_bbox(sp::Subplot{GRBackend}, bb::BoundingBox, w, h, vi
viewport[3] = viewport_canvas[4] * (1.0 - bottom(bb) / h)
viewport[4] = viewport_canvas[4] * (1.0 - top(bb) / h)
if hascolorbar(sp)
viewport[2] -= gr_colorbar_ratio * (1 + is3d(sp) / 2)
viewport[2] -= gr_colorbar_ratio * (1 + RecipesPipeline.is3d(sp) / 2)
end
viewport
end
@ -436,8 +436,8 @@ end
# change so we're focused on the viewport area
function gr_set_viewport_cmap(sp::Subplot)
GR.setviewport(
viewport_plotarea[2] + (is3d(sp) ? 0.07 : 0.02),
viewport_plotarea[2] + (is3d(sp) ? 0.10 : 0.05),
viewport_plotarea[2] + (RecipesPipeline.is3d(sp) ? 0.07 : 0.02),
viewport_plotarea[2] + (RecipesPipeline.is3d(sp) ? 0.10 : 0.05),
viewport_plotarea[3],
viewport_plotarea[4]
)
@ -833,7 +833,7 @@ function _update_min_padding!(sp::Subplot{GRBackend})
toppad += h
end
if is3d(sp)
if RecipesPipeline.is3d(sp)
xaxis, yaxis, zaxis = sp[:xaxis], sp[:yaxis], sp[:zaxis]
xticks, yticks, zticks = get_ticks(sp, xaxis), get_ticks(sp, yaxis), get_ticks(sp, zaxis)
# Add margin for x and y ticks
@ -1053,7 +1053,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
# fill in the plot area background
bg = plot_color(sp[:background_color_inside])
is3d(sp) || gr_fill_viewport(viewport_plotarea, bg)
RecipesPipeline.is3d(sp) || gr_fill_viewport(viewport_plotarea, bg)
# reduced from before... set some flags based on the series in this subplot
# TODO: can these be generic flags?
@ -1124,7 +1124,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
gr_set_font(tickfont(xaxis))
GR.setlinewidth(sp.plt[:thickness_scaling])
if is3d(sp)
if RecipesPipeline.is3d(sp)
zmin, zmax = axis_limits(sp, :z)
GR.setspace(zmin, zmax, round.(Int, sp[:camera])...)
@ -1135,7 +1135,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
plot_area_x = [xmin, xmin, xmin, xmax, xmax, xmax, xmin]
plot_area_y = [ymin, ymin, ymax, ymax, ymax, ymin, ymin]
plot_area_z = [zmin, zmax, zmax, zmax, zmin, zmin, zmin]
x_bg, y_bg = unzip(GR.wc3towc.(plot_area_x, plot_area_y, plot_area_z))
x_bg, y_bg = RecipesPipeline.unzip(GR.wc3towc.(plot_area_x, plot_area_y, plot_area_z))
GR.fillarea(x_bg, y_bg)
# draw the grid lines
@ -1456,7 +1456,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
GR.settextalign(halign, GR.TEXT_VALIGN_TOP)
gr_text(xpos, viewport_subplot[4], sp[:title])
end
if is3d(sp)
if RecipesPipeline.is3d(sp)
if xaxis[:guide] != ""
gr_set_font(
guidefont(xaxis),
@ -1713,7 +1713,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
# draw markers
if st == :scatter3d || series[:markershape] != :none
x2, y2 = unzip(map(GR.wc3towc, x, y, z))
x2, y2 = RecipesPipeline.unzip(map(GR.wc3towc, x, y, z))
gr_draw_markers(series, x2, y2, clims)
end
@ -1912,7 +1912,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
end
for ann in sp[:annotations]
x, y, val = locate_annotation(sp, ann...)
x, y = if is3d(sp)
x, y = if RecipesPipeline.is3d(sp)
gr_w3tondc(x, y, z)
else
GR.wctondc(x, y)

View File

@ -166,7 +166,7 @@ function pgf_series(sp::Subplot, series::Series)
# function args
args = if st == :contour
plotattributes[:z].surf, plotattributes[:x], plotattributes[:y]
elseif is3d(st)
elseif RecipesPipeline.is3d(st)
plotattributes[:x], plotattributes[:y], plotattributes[:z]
elseif st == :straightline
straightline_data(series)
@ -271,7 +271,7 @@ function pgf_fillrange_series(series, i, fillrange, args...)
push!(style, _pgf_series_extrastyle[st])
end
kw[:style] = join(style, ',')
func = is3d(series) ? PGFPlots.Linear3 : PGFPlots.Linear
func = RecipesPipeline.is3d(series) ? PGFPlots.Linear3 : PGFPlots.Linear
return func(pgf_fillrange_args(fillrange, args...)...; kw...)
end
@ -444,7 +444,7 @@ function _update_plot_object(plt::Plot{PGFPlotsBackend})
# add to style/kw for each axis
for letter in (:x, :y, :z)
if letter != :z || is3d(sp)
if letter != :z || RecipesPipeline.is3d(sp)
axisstyle, axiskw = pgf_axis(sp, letter)
append!(style, axisstyle)
merge!(kw, axiskw)
@ -494,7 +494,7 @@ function _update_plot_object(plt::Plot{PGFPlotsBackend})
if any(s[:seriestype] == :contour for s in series_list(sp))
kw[:view] = "{0}{90}"
kw[:colorbar] = !(sp[:colorbar] in (:none, :off, :hide, false))
elseif is3d(sp)
elseif RecipesPipeline.is3d(sp)
azim, elev = sp[:camera]
kw[:view] = "{$(azim)}{$(elev)}"
end

View File

@ -185,7 +185,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
)
end
for letter in (:x, :y, :z)
if letter != :z || is3d(sp)
if letter != :z || RecipesPipeline.is3d(sp)
pgfx_axis!(axis_opt, sp, letter)
end
end
@ -228,7 +228,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
"point meta min" => get_clims(sp)[1],
),
)
if is3d(sp)
if RecipesPipeline.is3d(sp)
azim, elev = sp[:camera]
push!(axis_opt, "view" => (azim, elev))
end
@ -251,7 +251,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
"color" => single_color(opt[:linecolor]),
"name path" => string(series_id),
)
if is3d(series) || st == :heatmap
if RecipesPipeline.is3d(series) || st == :heatmap
series_func = PGFPlotsX.Plot3
else
series_func = PGFPlotsX.Plot
@ -422,7 +422,7 @@ end
opt[:x], opt[:y], Array(opt[:z])'
elseif st in (:heatmap, :surface, :wireframe)
surface_to_vecs(opt[:x], opt[:y], opt[:z])
elseif is3d(st)
elseif RecipesPipeline.is3d(st)
opt[:x], opt[:y], opt[:z]
elseif st == :straightline
straightline_data(series)
@ -874,7 +874,7 @@ function pgfx_fillrange_series!(axis, series, series_func, i, fillrange, rng)
fillrange_opt = merge(fillrange_opt, pgfx_marker(series, i))
push!(fillrange_opt, "forget plot" => nothing)
opt = series.plotattributes
args = is3d(series) ? (opt[:x][rng], opt[:y][rng], opt[:z][rng]) :
args = RecipesPipeline.is3d(series) ? (opt[:x][rng], opt[:y][rng], opt[:z][rng]) :
(opt[:x][rng], opt[:y][rng])
push!(
axis,

View File

@ -162,7 +162,7 @@ function plotly_axis(plt::Plot, axis::Axis, sp::Subplot)
if letter in (:x,:y)
ax[:domain] = plotly_domain(sp, letter)
if is3d(sp)
if RecipesPipeline.is3d(sp)
# don't link 3d axes for synchronized interactivity
x_idx = y_idx = sp[:subplot_index]
else
@ -263,8 +263,8 @@ function plotly_layout(plt::Plot)
# set to supported framestyle
sp[:framestyle] = _plotly_framestyle(sp[:framestyle])
# if any(is3d, seriesargs)
if is3d(sp)
# if any(RecipesPipeline.is3d, seriesargs)
if RecipesPipeline.is3d(sp)
azim = sp[:camera][1] - 90 #convert azimuthal to match GR behaviour
theta = 90 - sp[:camera][2] #spherical coordinate angle from z axis
plotattributes_out[:scene] = KW(
@ -748,11 +748,11 @@ function plotly_colorbar_hack(series::Series, plotattributes_base::KW, sym::Symb
plotattributes_out = deepcopy(plotattributes_base)
cmin, cmax = get_clims(series[:subplot])
plotattributes_out[:showlegend] = false
plotattributes_out[:type] = is3d(series) ? :scatter3d : :scatter
plotattributes_out[:type] = RecipesPipeline.is3d(series) ? :scatter3d : :scatter
plotattributes_out[:hoverinfo] = :none
plotattributes_out[:mode] = :markers
plotattributes_out[:x], plotattributes_out[:y] = [series[:x][1]], [series[:y][1]]
if is3d(series)
if RecipesPipeline.is3d(series)
plotattributes_out[:z] = [series[:z][1]]
end
# zrange = zmax == zmin ? 1 : zmax - zmin # if all marker_z values are the same, plot all markers same color (avoids division by zero in next line)

View File

@ -448,7 +448,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
# :norm => pycolors["Normalize"](; extrakw...)
# )
# lz = _cycle(series[:line_z], 1:n)
# handle = if is3d(st)
# handle = if RecipesPipeline.is3d(st)
# line_segments = [[(x[j], y[j], z[j]) for j in rng] for rng in segments]
# lc = pyart3d["Line3DCollection"](line_segments; kw...)
# lc[:set_array](lz)
@ -478,7 +478,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
# end
a = series[:arrow]
if a !== nothing && !is3d(st) # TODO: handle 3d later
if a !== nothing && !RecipesPipeline.is3d(st) # TODO: handle 3d later
if typeof(a) != Arrow
@warn("Unexpected type for arrow: $(typeof(a))")
else
@ -1050,7 +1050,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
end
# framestyle
if !ispolar(sp) && !is3d(sp)
if !ispolar(sp) && !RecipesPipeline.is3d(sp)
ax.spines["left"]."set_linewidth"(py_thickness_scale(plt, 1))
ax.spines["bottom"]."set_linewidth"(py_thickness_scale(plt, 1))
if sp[:framestyle] == :semi
@ -1161,7 +1161,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
end
#camera/view angle
if is3d(sp)
if RecipesPipeline.is3d(sp)
#convert azimuthal to match GR behaviour
#view_init(elevation, azimuthal) so reverse :camera args
ax."view_init"((sp[:camera].-(90,0))[end:-1:1]...)

View File

@ -126,7 +126,7 @@ function addUnicodeSeries!(o, plotattributes, addlegend::Bool, xlim, ylim)
color = plotattributes[:linecolor] in UnicodePlots.color_cycle ? plotattributes[:linecolor] : :auto
# add the series
x, y = Plots.unzip(collect(Base.Iterators.filter(xy->isfinite(xy[1])&&isfinite(xy[2]), zip(x,y))))
x, y = RecipesPipeline.unzip(collect(Base.Iterators.filter(xy->isfinite(xy[1])&&isfinite(xy[2]), zip(x,y))))
func(o, x, y; color = color, name = label)
end

View File

@ -29,7 +29,7 @@ end
Construct a polygon to be plotted
"""
Shape(verts::AVec) = Shape(unzip(verts)...)
Shape(verts::AVec) = Shape(RecipesPipeline.unzip(verts)...)
Shape(s::Shape) = deepcopy(s)
get_xs(shape::Shape) = shape.x

View File

@ -14,7 +14,7 @@ function RecipesPipeline.warn_on_recipe_aliases!(
if k !== dk
@warn "Attribute alias `$k` detected in the $recipe_type recipe defined for the signature $(_signature_string(Val{recipe_type}, args...)). To ensure expected behavior it is recommended to use the default attribute `$dk`."
end
plotattributes[dk] = pop_kw!(plotattributes, k)
plotattributes[dk] = RecipesPipeline.pop_kw!(plotattributes, k)
end
end
end
@ -57,7 +57,7 @@ end
## Preprocessing attributes
RecipesPipeline.preprocess_attributes!(plt::Plot, plotattributes) =
preprocess_attributes!(plotattributes) # in src/args.jl
RecipesPipeline.preprocess_attributes!(plotattributes) # in src/args.jl
RecipesPipeline.is_axis_attribute(plt::Plot, attr) = is_axis_attr_noletter(attr) # in src/args.jl
@ -298,7 +298,7 @@ function _prepare_subplot(plt::Plot{T}, plotattributes::AKW) where {T}
st = _override_seriestype_check(plotattributes, st)
# change to a 3d projection for this subplot?
if needs_3d_axes(st)
if RecipesPipeline.is_surface(st)
sp.attr[:projection] = "3d"
end
@ -312,7 +312,7 @@ end
function _override_seriestype_check(plotattributes::AKW, st::Symbol)
# do we want to override the series type?
if !is3d(st) && !(st in (:contour, :contour3d))
if !RecipesPipeline.is3d(st) && !(st in (:contour, :contour3d))
z = plotattributes[:z]
if !isa(z, Nothing) &&
(size(plotattributes[:x]) == size(plotattributes[:y]) == size(z))

View File

@ -49,7 +49,7 @@ as a String to look up its docstring; e.g. `plotattr("seriestype")`.
function plot(args...; kw...)
# this creates a new plot with args/kw and sets it to be the current plot
plotattributes = KW(kw)
preprocess_attributes!(plotattributes)
RecipesPipeline.preprocess_attributes!(plotattributes)
# create an empty Plot then process
plt = Plot()
@ -61,7 +61,7 @@ end
# note: we split into plt1 and plts_tail so we can dispatch correctly
function plot(plt1::Plot, plts_tail::Plot...; kw...)
plotattributes = KW(kw)
preprocess_attributes!(plotattributes)
RecipesPipeline.preprocess_attributes!(plotattributes)
# build our plot vector from the args
n = length(plts_tail) + 1
@ -153,7 +153,7 @@ end
# this adds to a specific plot... most plot commands will flow through here
function plot!(plt::Plot, args...; kw...)
plotattributes = KW(kw)
preprocess_attributes!(plotattributes)
RecipesPipeline.preprocess_attributes!(plotattributes)
# merge!(plt.user_attr, plotattributes)
_plot!(plt, plotattributes, args)
end
@ -212,5 +212,3 @@ function plot!(sp::Subplot, args...; kw...)
plt = sp.plt
plot!(plt, args...; kw..., subplot = findfirst(isequal(sp), plt.subplots))
end
# --------------------------------------------------------------------

View File

@ -458,7 +458,7 @@ end
end
@deps plots_heatmap shape
is_3d(::Type{Val{:plots_heatmap}}) = true
is_surface(::Type{Val{:plots_heatmap}}) = true
RecipesPipeline.is_surface(::Type{Val{:plots_heatmap}}) = true
# ---------------------------------------------------------------------------
# Histograms
@ -1164,7 +1164,7 @@ function quiver_using_hack(plotattributes::AKW)
)
end
plotattributes[:x], plotattributes[:y] = Plots.unzip(pts[2:end])
plotattributes[:x], plotattributes[:y] = RecipesPipeline.unzip(pts[2:end])
# KW[plotattributes]
end
@ -1283,13 +1283,13 @@ end
# --------------------------------------------------------------------
# Lists of tuples and GeometryTypes.Points
# --------------------------------------------------------------------
@recipe f(v::AVec{<:GeometryTypes.Point}) = unzip(v)
@recipe f(v::AVec{<:GeometryTypes.Point}) = RecipesPipeline.unzip(v)
@recipe f(p::GeometryTypes.Point) = [p]
# Special case for 4-tuples in :ohlc series
@recipe f(xyuv::AVec{<:Tuple{R1, R2, R3, R4}}) where {R1, R2, R3, R4} =
get(plotattributes, :seriestype, :path) == :ohlc ? OHLC[OHLC(t...) for t in xyuv] :
unzip(xyuv)
RecipesPipeline.unzip(xyuv)
# -------------------------------------------------

View File

@ -79,7 +79,7 @@ function iter_segments(series::Series)
end
else
segs = UnitRange{Int}[]
args = is3d(series) ? (x, y, z) : (x, y)
args = RecipesPipeline.is3d(series) ? (x, y, z) : (x, y)
for seg in iter_segments(args...)
push!(segs, seg)
end
@ -145,14 +145,14 @@ maketuple(x::Tuple{T,S}) where {T,S} = x
for i in 2:4
@eval begin
unzip(v::Union{AVec{<:Tuple{Vararg{T,$i} where T}},
RecipesPipeline.unzip(v::Union{AVec{<:Tuple{Vararg{T,$i} where T}},
AVec{<:GeometryTypes.Point{$i}}}) = $(Expr(:tuple, (:([t[$j] for t in v]) for j=1:i)...))
end
end
unzip(v::Union{AVec{<:GeometryTypes.Point{N}},
RecipesPipeline.unzip(v::Union{AVec{<:GeometryTypes.Point{N}},
AVec{<:Tuple{Vararg{T,N} where T}}}) where N = error("$N-dimensional unzip not implemented.")
unzip(v::Union{AVec{<:GeometryTypes.Point},
RecipesPipeline.unzip(v::Union{AVec{<:GeometryTypes.Point},
AVec{<:Tuple}}) = error("Can't unzip points of different dimensions.")
# given 2-element lims and a vector of data x, widen lims to account for the extrema of x
@ -187,7 +187,7 @@ end
function replaceAlias!(plotattributes::AKW, k::Symbol, aliases::Dict{Symbol,Symbol})
if haskey(aliases, k)
plotattributes[aliases[k]] = pop_kw!(plotattributes, k)
plotattributes[aliases[k]] = RecipesPipeline.pop_kw!(plotattributes, k)
end
end
@ -226,7 +226,7 @@ end
"create an (n+1) list of the outsides of heatmap rectangles"
function heatmap_edges(v::AVec, scale::Symbol = :identity, isedges::Bool = false)
f, invf = scale_func(scale), inverse_scale_func(scale)
f, invf = RecipesPipeline.scale_func(scale), RecipesPipeline.inverse_scale_func(scale)
map(invf, _heatmap_edges(map(f,v), isedges))
end
@ -835,7 +835,7 @@ end
function attr!(series::Series; kw...)
plotattributes = KW(kw)
preprocess_attributes!(plotattributes)
RecipesPipeline.preprocess_attributes!(plotattributes)
for (k,v) in plotattributes
if haskey(_series_defaults, k)
series[k] = v
@ -849,7 +849,7 @@ end
function attr!(sp::Subplot; kw...)
plotattributes = KW(kw)
preprocess_attributes!(plotattributes)
RecipesPipeline.preprocess_attributes!(plotattributes)
for (k,v) in plotattributes
if haskey(_subplot_defaults, k)
sp[k] = v