diff --git a/src/axes.jl b/src/axes.jl index 094d4494..6f00a27a 100644 --- a/src/axes.jl +++ b/src/axes.jl @@ -8,7 +8,7 @@ function Axis(sp::Subplot, letter::Symbol, args...; kw...) # init with values from _plot_defaults - d = KW( + plotattributes = KW( :letter => letter, # :extrema => (Inf, -Inf), :extrema => Extrema(), @@ -22,14 +22,14 @@ function Axis(sp::Subplot, letter::Symbol, args...; kw...) for (k,v) in _axis_defaults lk = Symbol(letter, k) lv = _axis_defaults_byletter[lk] - d[k] = (lv == :match ? v : lv) + plotattributes[k] = (lv == :match ? v : lv) end - # merge!(d, _axis_defaults) - d[:discrete_values] = [] + # merge!(plotattributes, _axis_defaults) + plotattributes[:discrete_values] = [] # update the defaults - attr!(Axis([sp], d), args...; kw...) + attr!(Axis([sp], plotattributes), args...; kw...) end function get_axis(sp::Subplot, letter::Symbol) @@ -41,45 +41,45 @@ function get_axis(sp::Subplot, letter::Symbol) end::Axis end -function process_axis_arg!(d::KW, arg, letter = "") +function process_axis_arg!(plotattributes::KW, arg, letter = "") T = typeof(arg) arg = get(_scaleAliases, arg, arg) if typeof(arg) <: Font - d[Symbol(letter,:tickfont)] = arg - d[Symbol(letter,:guidefont)] = arg + plotattributes[Symbol(letter,:tickfont)] = arg + plotattributes[Symbol(letter,:guidefont)] = arg elseif arg in _allScales - d[Symbol(letter,:scale)] = arg + plotattributes[Symbol(letter,:scale)] = arg elseif arg in (:flip, :invert, :inverted) - d[Symbol(letter,:flip)] = true + plotattributes[Symbol(letter,:flip)] = true elseif T <: AbstractString - d[Symbol(letter,:guide)] = arg + plotattributes[Symbol(letter,:guide)] = arg # xlims/ylims elseif (T <: Tuple || T <: AVec) && length(arg) == 2 sym = typeof(arg[1]) <: Number ? :lims : :ticks - d[Symbol(letter,sym)] = arg + plotattributes[Symbol(letter,sym)] = arg # xticks/yticks elseif T <: AVec - d[Symbol(letter,:ticks)] = arg + plotattributes[Symbol(letter,:ticks)] = arg elseif arg == nothing - d[Symbol(letter,:ticks)] = [] + plotattributes[Symbol(letter,:ticks)] = [] elseif T <: Bool || arg in _allShowaxisArgs - d[Symbol(letter,:showaxis)] = showaxis(arg, letter) + plotattributes[Symbol(letter,:showaxis)] = showaxis(arg, letter) elseif typeof(arg) <: Number - d[Symbol(letter,:rotation)] = arg + plotattributes[Symbol(letter,:rotation)] = arg elseif typeof(arg) <: Function - d[Symbol(letter,:formatter)] = arg + plotattributes[Symbol(letter,:formatter)] = arg - elseif !handleColors!(d, arg, Symbol(letter, :foreground_color_axis)) + elseif !handleColors!(plotattributes, arg, Symbol(letter, :foreground_color_axis)) @warn("Skipped $(letter)axis arg $arg") end @@ -88,28 +88,28 @@ end # update an Axis object with magic args and keywords function attr!(axis::Axis, args...; kw...) # first process args - d = axis.d + plotattributes = axis.plotattributes for arg in args - process_axis_arg!(d, arg) + process_axis_arg!(plotattributes, arg) end - # then override for any keywords... only those keywords that already exists in d + # then override for any keywords... only those keywords that already exists in plotattributes for (k,v) in kw - if haskey(d, k) + if haskey(plotattributes, k) if k == :discrete_values # add these discrete values to the axis for vi in v discrete_value!(axis, vi) end else - d[k] = v + plotattributes[k] = v end end end # replace scale aliases - if haskey(_scaleAliases, d[:scale]) - d[:scale] = _scaleAliases[d[:scale]] + if haskey(_scaleAliases, plotattributes[:scale]) + plotattributes[:scale] = _scaleAliases[plotattributes[:scale]] end axis @@ -117,10 +117,10 @@ end # ------------------------------------------------------------------------- -Base.show(io::IO, axis::Axis) = dumpdict(axis.d, "Axis", true) -# Base.getindex(axis::Axis, k::Symbol) = getindex(axis.d, k) -Base.setindex!(axis::Axis, v, ks::Symbol...) = setindex!(axis.d, v, ks...) -Base.haskey(axis::Axis, k::Symbol) = haskey(axis.d, k) +Base.show(io::IO, axis::Axis) = dumpdict(axis.plotattributes, "Axis", true) +# Base.getindex(axis::Axis, k::Symbol) = getindex(axis.plotattributes, k) +Base.setindex!(axis::Axis, v, ks::Symbol...) = setindex!(axis.plotattributes, v, ks...) +Base.haskey(axis::Axis, k::Symbol) = haskey(axis.plotattributes, k) ignorenan_extrema(axis::Axis) = (ex = axis[:extrema]; (ex.emin, ex.emax)) @@ -290,9 +290,9 @@ function get_minor_ticks(axis,ticks) axis[:minorticks] in (nothing, false) && !axis[:minorgrid] && return nothing ticks = ticks[1] length(ticks) < 2 && return nothing - + amin, amax = axis_limits(axis) - #Add one phantom tick either side of the ticks to ensure minor ticks extend to the axis limits + #Add one phantom tick either side of the ticks to ensure minor ticks extend to the axis limits if length(ticks) > 2 ratio = (ticks[3] - ticks[2])/(ticks[2] - ticks[1]) elseif axis[:scale] == :none @@ -322,7 +322,7 @@ function reset_extrema!(sp::Subplot) sp[Symbol(asym,:axis)][:extrema] = Extrema() end for series in sp.series_list - expand_extrema!(sp, series.d) + expand_extrema!(sp, series.plotattributes) end end @@ -357,17 +357,17 @@ function expand_extrema!(axis::Axis, v::AVec{N}) where N<:Number end -function expand_extrema!(sp::Subplot, d::KW) - vert = isvertical(d) +function expand_extrema!(sp::Subplot, plotattributes::KW) + vert = isvertical(plotattributes) # first expand for the data for letter in (:x, :y, :z) - data = d[if vert + data = plotattributes[if vert letter else letter == :x ? :y : letter == :y ? :x : :z end] - if letter != :z && d[:seriestype] == :straightline && any(series[:seriestype] != :straightline for series in series_list(sp)) && data[1] != data[2] + if letter != :z && plotattributes[:seriestype] == :straightline && any(series[:seriestype] != :straightline for series in series_list(sp)) && data[1] != data[2] data = [NaN] end axis = sp[Symbol(letter, "axis")] @@ -379,30 +379,30 @@ function expand_extrema!(sp::Subplot, d::KW) elseif eltype(data) <: Number || (isa(data, Surface) && all(di -> isa(di, Number), data.surf)) if !(eltype(data) <: Number) # huh... must have been a mis-typed surface? lets swap it out - data = d[letter] = Surface(Matrix{Float64}(data.surf)) + data = plotattributes[letter] = Surface(Matrix{Float64}(data.surf)) end expand_extrema!(axis, data) elseif data != nothing # TODO: need more here... gotta track the discrete reference value # as well as any coord offset (think of boxplot shape coords... they all # correspond to the same x-value) - d[letter], d[Symbol(letter,"_discrete_indices")] = discrete_value!(axis, data) - expand_extrema!(axis, d[letter]) + plotattributes[letter], plotattributes[Symbol(letter,"_discrete_indices")] = discrete_value!(axis, data) + expand_extrema!(axis, plotattributes[letter]) end end # # expand for fillrange/bar_width # fillaxis, baraxis = sp.attr[:yaxis], sp.attr[:xaxis] - # if isvertical(d) + # if isvertical(plotattributes) # fillaxis, baraxis = baraxis, fillaxis # end # expand for fillrange - fr = d[:fillrange] - if fr == nothing && d[:seriestype] == :bar + fr = plotattributes[:fillrange] + if fr == nothing && plotattributes[:seriestype] == :bar fr = 0.0 end - if fr != nothing && !all3D(d) + if fr != nothing && !all3D(plotattributes) axis = sp.attr[vert ? :yaxis : :xaxis] if typeof(fr) <: Tuple for fri in fr @@ -414,13 +414,13 @@ function expand_extrema!(sp::Subplot, d::KW) end # expand for bar_width - if d[:seriestype] == :bar + if plotattributes[:seriestype] == :bar dsym = vert ? :x : :y - data = d[dsym] + data = plotattributes[dsym] - bw = d[:bar_width] + bw = plotattributes[:bar_width] if bw == nothing - bw = d[:bar_width] = _bar_width * ignorenan_minimum(filter(x->x>0,diff(sort(data)))) + bw = plotattributes[:bar_width] = _bar_width * ignorenan_minimum(filter(x->x>0,diff(sort(data)))) end axis = sp.attr[Symbol(dsym, :axis)] expand_extrema!(axis, ignorenan_maximum(data) + 0.5maximum(bw)) @@ -428,11 +428,11 @@ function expand_extrema!(sp::Subplot, d::KW) end # expand for heatmaps - if d[:seriestype] == :heatmap + if plotattributes[:seriestype] == :heatmap for letter in (:x, :y) - data = d[letter] + data = plotattributes[letter] axis = sp[Symbol(letter, "axis")] - scale = get(d, Symbol(letter, "scale"), :identity) + scale = get(plotattributes, Symbol(letter, "scale"), :identity) expand_extrema!(axis, heatmap_edges(data, scale)) end end @@ -462,7 +462,7 @@ function default_should_widen(axis::Axis) if !is_2tuple(axis[:lims]) for sp in axis.sps for series in series_list(sp) - if series.d[:seriestype] in _widen_seriestypes + if series.plotattributes[:seriestype] in _widen_seriestypes should_widen = true end end @@ -572,12 +572,12 @@ end # ------------------------------------------------------------------------- function pie_labels(sp::Subplot, series::Series) - d = series.d - if haskey(d,:x_discrete_indices) - dvals = sp.attr[:xaxis].d[:discrete_values] - [dvals[idx] for idx in d[:x_discrete_indices]] + plotattributes = series.plotattributes + if haskey(plotattributes,:x_discrete_indices) + dvals = sp.attr[:xaxis].plotattributes[:discrete_values] + [dvals[idx] for idx in plotattributes[:x_discrete_indices]] else - d[:x] + plotattributes[:x] end end diff --git a/src/deprecated/series_args.jl b/src/deprecated/series_args.jl index f0dc4dc4..4dafda80 100644 --- a/src/deprecated/series_args.jl +++ b/src/deprecated/series_args.jl @@ -7,7 +7,7 @@ const FuncOrFuncs = Union{Function, AVec{Function}} -all3D(plotattributes::KW) = trueOrAllTrue(st -> st in (:contour, :contourf, :heatmap, :surface, :wireframe, :contour3d, :image), get(d, :seriestype, :none)) +all3D(plotattributes::KW) = trueOrAllTrue(st -> st in (:contour, :contourf, :heatmap, :surface, :wireframe, :contour3d, :image), get(plotattributes, :seriestype, :none)) # missing convertToAnyVector(v::Nothing, plotattributes::KW) = Any[nothing], nothing @@ -22,7 +22,7 @@ convertToAnyVector(v::AVec{T}, plotattributes::KW) where {T<:Number} = Any[v], n convertToAnyVector(v::AVec{T}, plotattributes::KW) where {T<:AbstractString} = Any[v], nothing function convertToAnyVector(v::AMat, plotattributes::KW) - if all3D(d) + if all3D(plotattributes) Any[Surface(v)] else Any[v[:,i] for i in 1:size(v,2)] @@ -48,7 +48,7 @@ function convertToAnyVector(v::AVec, plotattributes::KW) Any[convert(Vector{Float64}, v)], nothing else # something else... treat each element as an item - vcat(Any[convertToAnyVector(vi, d)[1] for vi in v]...), nothing + vcat(Any[convertToAnyVector(vi, plotattributes)[1] for vi in v]...), nothing # Any[vi for vi in v], nothing end end diff --git a/src/layouts.jl b/src/layouts.jl index b61561aa..2527cfc3 100644 --- a/src/layouts.jl +++ b/src/layouts.jl @@ -465,11 +465,11 @@ end # pass the layout arg through function layout_args(plotattributes::KW) - layout_args(get(d, :layout, default(:layout))) + layout_args(get(plotattributes, :layout, default(:layout))) end function layout_args(plotattributes::KW, n_override::Integer) - layout, n = layout_args(get(d, :layout, n_override)) + layout, n = layout_args(get(plotattributes, :layout, n_override)) if n != n_override error("When doing layout, n ($n) != n_override ($(n_override)). You're probably trying to force existing plots into a layout that doesn't fit them.") end diff --git a/src/plot.jl b/src/plot.jl index 20b12550..7ac78601 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -48,20 +48,20 @@ 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 - d = KW(kw) - preprocessArgs!(d) + plotattributes = KW(kw) + preprocessArgs!(plotattributes) # create an empty Plot then process plt = Plot() - # plt.user_attr = d - _plot!(plt, d, args) + # plt.user_attr = plotattributes + _plot!(plt, plotattributes, args) end # build a new plot from existing plots # note: we split into plt1 and plts_tail so we can dispatch correctly function plot(plt1::Plot, plts_tail::Plot...; kw...) - d = KW(kw) - preprocessArgs!(d) + plotattributes = KW(kw) + preprocessArgs!(plotattributes) # build our plot vector from the args n = length(plts_tail) + 1 @@ -72,7 +72,7 @@ function plot(plt1::Plot, plts_tail::Plot...; kw...) end # compute the layout - layout = layout_args(d, n)[1] + layout = layout_args(plotattributes, n)[1] num_sp = sum([length(p.subplots) for p in plts]) # create a new plot object, with subplot list/map made of existing subplots. @@ -83,21 +83,21 @@ function plot(plt1::Plot, plts_tail::Plot...; kw...) # TODO: build the user_attr dict by creating "Any matrices" for the args of each subplot # TODO: replace this with proper processing from a merged user_attr KW - # update plot args, first with existing plots, then override with d + # update plot args, first with existing plots, then override with plotattributes for p in plts _update_plot_args(plt, copy(p.attr)) plt.n += p.n end - _update_plot_args(plt, d) + _update_plot_args(plt, plotattributes) # pass new plot to the backend plt.o = _create_backend_figure(plt) plt.init = true series_attr = KW() - for (k,v) in d + for (k,v) in plotattributes if haskey(_series_defaults, k) - series_attr[k] = pop!(d,k) + series_attr[k] = pop!(plotattributes,k) end end @@ -118,8 +118,8 @@ function plot(plt1::Plot, plts_tail::Plot...; kw...) sp.plt = plt sp.attr[:subplot_index] = idx for series in serieslist - merge!(series.d, series_attr) - _add_defaults!(series.d, plt, sp, cmdidx) + merge!(series.plotattributes, series_attr) + _add_defaults!(series.plotattributes, plt, sp, cmdidx) push!(plt.series_list, series) _series_added(plt, series) cmdidx += 1 @@ -128,12 +128,12 @@ function plot(plt1::Plot, plts_tail::Plot...; kw...) # first apply any args for the subplots for (idx,sp) in enumerate(plt.subplots) - _update_subplot_args(plt, sp, d, idx, false) + _update_subplot_args(plt, sp, plotattributes, idx, false) end # finish up current(plt) - _do_plot_show(plt, get(d, :show, default(:show))) + _do_plot_show(plt, get(plotattributes, :show, default(:show))) plt end @@ -152,10 +152,10 @@ end # this adds to a specific plot... most plot commands will flow through here function plot!(plt::Plot, args...; kw...) - d = KW(kw) - preprocessArgs!(d) - # merge!(plt.user_attr, d) - _plot!(plt, d, args) + plotattributes = KW(kw) + preprocessArgs!(plotattributes) + # merge!(plt.user_attr, plotattributes) + _plot!(plt, plotattributes, args) end # ------------------------------------------------------------------------------- @@ -164,7 +164,7 @@ end # a list of series KW dicts. # note: at entry, we only have those preprocessed args which were passed in... no default values yet function _plot!(plt::Plot, plotattributes::KW, args::Tuple) - d[:plot_object] = plt + plotattributes[:plot_object] = plt if !isempty(args) && !isdefined(Main, :StatPlots) && first(split(string(typeof(args[1])), ".")) == "DataFrames" @@ -175,7 +175,7 @@ function _plot!(plt::Plot, plotattributes::KW, args::Tuple) # "USER RECIPES" # -------------------------------- - kw_list = _process_userrecipes(plt, d, args) + kw_list = _process_userrecipes(plt, plotattributes, args) # @info(1) # map(DD, kw_list) @@ -202,8 +202,8 @@ function _plot!(plt::Plot, plotattributes::KW, args::Tuple) # -------------------------------- # Plot/Subplot/Layout setup # -------------------------------- - _plot_setup(plt, d, kw_list) - _subplot_setup(plt, d, kw_list) + _plot_setup(plt, plotattributes, kw_list) + _subplot_setup(plt, plotattributes, kw_list) # !!! note: At this point, kw_list is fully decomposed into individual series... one KW per series. !!! # !!! The next step is to recursively apply series recipes until the backend supports that series type !!! diff --git a/src/utils.jl b/src/utils.jl index fe25ae5f..0db12bc5 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -19,15 +19,15 @@ A hacky replacement for a histogram when the backend doesn't support histograms Convert it into a bar chart with the appropriate x/y values. """ function histogramHack(; kw...) - d = KW(kw) + plotattributes = KW(kw) # we assume that the y kwarg is set with the data to be binned, and nbins is also defined - edges, midpoints, buckets, counts = binData(d[:y], d[:bins]) - d[:x] = midpoints - d[:y] = float(counts) - d[:seriestype] = :bar - d[:fillrange] = d[:fillrange] == nothing ? 0.0 : d[:fillrange] - d + edges, midpoints, buckets, counts = binData(plotattributes[:y], plotattributes[:bins]) + plotattributes[:x] = midpoints + plotattributes[:y] = float(counts) + plotattributes[:seriestype] = :bar + plotattributes[:fillrange] = plotattributes[:fillrange] == nothing ? 0.0 : plotattributes[:fillrange] + plotattributes end """ @@ -35,10 +35,10 @@ A hacky replacement for a bar graph when the backend doesn't support bars direct Convert it into a line chart with fillrange set. """ function barHack(; kw...) - d = KW(kw) - midpoints = d[:x] - heights = d[:y] - fillrange = d[:fillrange] == nothing ? 0.0 : d[:fillrange] + plotattributes = KW(kw) + midpoints = plotattributes[:x] + heights = plotattributes[:y] + fillrange = plotattributes[:fillrange] == nothing ? 0.0 : plotattributes[:fillrange] # estimate the edges dists = diff(midpoints) * 0.5 @@ -62,11 +62,11 @@ function barHack(; kw...) append!(y, [fillrange, heights[i], heights[i], fillrange]) end - d[:x] = x - d[:y] = y - d[:seriestype] = :path - d[:fillrange] = fillrange - d + plotattributes[:x] = x + plotattributes[:y] = y + plotattributes[:seriestype] = :path + plotattributes[:fillrange] = fillrange + plotattributes end @@ -75,33 +75,33 @@ A hacky replacement for a sticks graph when the backend doesn't support sticks d Convert it into a line chart that traces the sticks, and a scatter that sets markers at the points. """ function sticksHack(; kw...) - dLine = KW(kw) - dScatter = copy(dLine) + plotattributesLine = KW(kw) + plotattributesScatter = copy(plotattributesLine) # these are the line vertices x = Float64[] y = Float64[] - fillrange = dLine[:fillrange] == nothing ? 0.0 : dLine[:fillrange] + fillrange = plotattributesLine[:fillrange] == nothing ? 0.0 : plotattributesLine[:fillrange] # calculate the vertices - yScatter = dScatter[:y] - for (i,xi) in enumerate(dScatter[:x]) + yScatter = plotattributesScatter[:y] + for (i,xi) in enumerate(plotattributesScatter[:x]) yi = yScatter[i] for j in 1:3 push!(x, xi) end append!(y, [fillrange, yScatter[i], fillrange]) end # change the line args - dLine[:x] = x - dLine[:y] = y - dLine[:seriestype] = :path - dLine[:markershape] = :none - dLine[:fillrange] = nothing + plotattributesLine[:x] = x + plotattributesLine[:y] = y + plotattributesLine[:seriestype] = :path + plotattributesLine[:markershape] = :none + plotattributesLine[:fillrange] = nothing # change the scatter args - dScatter[:seriestype] = :none + plotattributesScatter[:seriestype] = :none - dLine, dScatter + plotattributesLine, plotattributesScatter end function regressionXY(x, y) @@ -132,8 +132,8 @@ end function imageHack(plotattributes::KW) is_seriestype_supported(:heatmap) || error("Neither :image or :heatmap are supported!") - d[:seriestype] = :heatmap - d[:z], d[:fillcolor] = replace_image_with_heatmap(d[:z].surf) + plotattributes[:seriestype] = :heatmap + plotattributes[:z], plotattributes[:fillcolor] = replace_image_with_heatmap(plotattributes[:z].surf) end # --------------------------------------------------------------- @@ -330,14 +330,14 @@ end function replaceAlias!(plotattributes::KW, k::Symbol, aliases::Dict{Symbol,Symbol}) if haskey(aliases, k) - d[aliases[k]] = pop!(d, k) + plotattributes[aliases[k]] = pop!(plotattributes, k) end end function replaceAliases!(plotattributes::KW, aliases::Dict{Symbol,Symbol}) - ks = collect(keys(d)) + ks = collect(keys(plotattributes)) for k in ks - replaceAlias!(d, k, aliases) + replaceAlias!(plotattributes, k, aliases) end end @@ -347,7 +347,7 @@ Base.first(c::Colorant) = c Base.first(x::Symbol) = x -sortedkeys(d::Dict) = sort(collect(keys(d))) +sortedkeys(plotattributes::Dict) = sort(collect(keys(plotattributes))) const _scale_base = Dict{Symbol, Real}( @@ -432,8 +432,8 @@ isscalar(::Any) = false is_2tuple(v) = typeof(v) <: Tuple && length(v) == 2 -isvertical(plotattributes::KW) = get(d, :orientation, :vertical) in (:vertical, :v, :vert) -isvertical(series::Series) = isvertical(series.d) +isvertical(plotattributes::KW) = get(plotattributes, :orientation, :vertical) in (:vertical, :v, :vert) +isvertical(series::Series) = isvertical(series.plotattributes) ticksType(ticks::AVec{T}) where {T<:Real} = :ticks @@ -492,8 +492,8 @@ end # this is a helper function to determine whether we need to transpose a surface matrix. # it depends on whether the backend matches rows to x (transpose_on_match == true) or vice versa # for example: PyPlot sends rows to y, so transpose_on_match should be true -function transpose_z(d, z, transpose_on_match::Bool = true) - if d[:match_dimensions] == transpose_on_match +function transpose_z(plotattributes, z, transpose_on_match::Bool = true) + if plotattributes[:match_dimensions] == transpose_on_match # z' permutedims(z, [2,1]) else @@ -812,14 +812,14 @@ function dumpdict(plotattributes::KW, prefix = "", alwaysshow = false) if prefix != "" println(prefix, ":") end - for k in sort(collect(keys(d))) + for k in sort(collect(keys(plotattributes))) @printf("%14s: ", k) - debugshow(d[k]) + debugshow(plotattributes[k]) println() end println() end -DD(plotattributes::KW, prefix = "") = dumpdict(d, prefix, true) +DD(plotattributes::KW, prefix = "") = dumpdict(plotattributes, prefix, true) function dumpcallstack() @@ -845,25 +845,25 @@ tovec(v::AbstractVector) = v tovec(v::Nothing) = zeros(0) function getxy(plt::Plot, i::Integer) - d = plt.series_list[i].d - tovec(d[:x]), tovec(d[:y]) + plotattributes = plt.series_list[i].plotattributes + tovec(plotattributes[:x]), tovec(plotattributes[:y]) end function getxyz(plt::Plot, i::Integer) - d = plt.series_list[i].d - tovec(d[:x]), tovec(d[:y]), tovec(d[:z]) + plotattributes = plt.series_list[i].plotattributes + tovec(plotattributes[:x]), tovec(plotattributes[:y]), tovec(plotattributes[:z]) end function setxy!(plt::Plot, xy::Tuple{X,Y}, i::Integer) where {X,Y} series = plt.series_list[i] - series.d[:x], series.d[:y] = xy - sp = series.d[:subplot] + series.plotattributes[:x], series.plotattributes[:y] = xy + sp = series.plotattributes[:subplot] reset_extrema!(sp) _series_updated(plt, series) end function setxyz!(plt::Plot, xyz::Tuple{X,Y,Z}, i::Integer) where {X,Y,Z} series = plt.series_list[i] - series.d[:x], series.d[:y], series.d[:z] = xyz - sp = series.d[:subplot] + series.plotattributes[:x], series.plotattributes[:y], series.plotattributes[:z] = xyz + sp = series.plotattributes[:subplot] reset_extrema!(sp) _series_updated(plt, series) end @@ -912,9 +912,9 @@ Base.push!(series::Series, xi, yi, zi) = (push_x!(series,xi); push_y!(series,yi) # ------------------------------------------------------- function attr!(series::Series; kw...) - d = KW(kw) - preprocessArgs!(d) - for (k,v) in d + plotattributes = KW(kw) + preprocessArgs!(plotattributes) + for (k,v) in plotattributes if haskey(_series_defaults, k) series[k] = v else @@ -926,9 +926,9 @@ function attr!(series::Series; kw...) end function attr!(sp::Subplot; kw...) - d = KW(kw) - preprocessArgs!(d) - for (k,v) in d + plotattributes = KW(kw) + preprocessArgs!(plotattributes) + for (k,v) in plotattributes if haskey(_subplot_defaults, k) sp[k] = v else @@ -1057,9 +1057,9 @@ mm2px(mm::Real) = float(px / MM_PER_PX) "Smallest x in plot" -xmin(plt::Plot) = ignorenan_minimum([ignorenan_minimum(series.d[:x]) for series in plt.series_list]) +xmin(plt::Plot) = ignorenan_minimum([ignorenan_minimum(series.plotattributes[:x]) for series in plt.series_list]) "Largest x in plot" -xmax(plt::Plot) = ignorenan_maximum([ignorenan_maximum(series.d[:x]) for series in plt.series_list]) +xmax(plt::Plot) = ignorenan_maximum([ignorenan_maximum(series.plotattributes[:x]) for series in plt.series_list]) "Extrema of x-values in plot" ignorenan_extrema(plt::Plot) = (xmin(plt), xmax(plt))