working on markerstroke, name changes, and arg improvements

This commit is contained in:
Thomas Breloff 2015-11-06 15:49:27 -05:00
parent 391c7e8570
commit 6236acea02
16 changed files with 373 additions and 252 deletions

View File

@ -211,7 +211,7 @@ Keyword | Default | Type | Aliases
`:color_palette` | `auto` | Plot | `:palette`
`:fill` | `nothing` | Series | `:area`, `:f`
`:fillcolor` | `match` | Series | `:fc`, `:fcolor`, `:fillcolors`
`:fillopacity` | `nothing` | Series | `:fillopacitys`, `:fo`
`:fillalpha` | `nothing` | Series | `:fillalphas`, `:fo`
`:fillrange` | `nothing` | Series | `:fillranges`, `:fillrng`
`:foreground_color` | `auto` | Plot | `:fg`, `:fg_color`, `:fgcolor`, `:foreground`
`:grid` | `true` | Plot |
@ -222,7 +222,7 @@ Keyword | Default | Type | Aliases
`:legend` | `true` | Plot | `:leg`
`:legendfont` | `Plots.Font("Helvetica",8,:hcenter,:vcenter,0.0,RGB{U8}(0.0,0.0,0.0))` | Plot |
`:line` | `nothing` | Series | `:l`
`:lineopacity` | `nothing` | Series | `:lineopacitys`, `:lo`
`:linealpha` | `nothing` | Series | `:linealphas`, `:lo`
`:linestyle` | `solid` | Series | `:linestyles`, `:ls`, `:s`, `:style`
`:linetype` | `path` | Series | `:linetypes`, `:lt`, `:t`, `:type`
`:linewidth` | `1` | Series | `:linewidths`, `:lw`, `:w`, `:width`
@ -232,7 +232,7 @@ Keyword | Default | Type | Aliases
`:linky` | `false` | Plot | `:ylink`
`:marker` | `nothing` | Series | `:m`, `:mark`
`:markercolor` | `match` | Series | `:markercolors`, `:mc`, `:mcolor`
`:markeropacity` | `nothing` | Series | `:alpha`, `:markeropacitys`, `:mo`, `:opacity`
`:markeralpha` | `nothing` | Series | `:alpha`, `:markeralphas`, `:mo`, `:alpha`
`:markershape` | `none` | Series | `:markershapes`, `:shape`
`:markersize` | `6` | Series | `:markersizes`, `:ms`, `:msize`
`:n` | `-1` | Plot |

View File

@ -63,6 +63,8 @@ export
Shape,
text,
font,
stroke,
brush,
OHLC,
colorscheme,

View File

@ -110,34 +110,38 @@ subplotSupported() = subplotSupported(backend())
const _seriesDefaults = Dict{Symbol, Any}()
# series-specific
_seriesDefaults[:axis] = :left
_seriesDefaults[:color] = :auto
_seriesDefaults[:label] = "AUTO"
_seriesDefaults[:linetype] = :path
_seriesDefaults[:linestyle] = :solid
_seriesDefaults[:linewidth] = 1
_seriesDefaults[:lineopacity] = nothing
_seriesDefaults[:markershape] = :none
_seriesDefaults[:markercolor] = :match
_seriesDefaults[:markeropacity] = nothing
_seriesDefaults[:markersize] = 6
_seriesDefaults[:fillrange] = nothing # ribbons, areas, etc
_seriesDefaults[:fillcolor] = :match
_seriesDefaults[:fillopacity] = nothing
# _seriesDefaults[:ribbon] = nothing
# _seriesDefaults[:ribboncolor] = :match
_seriesDefaults[:nbins] = 30 # number of bins for heatmaps and hists
# _seriesDefaults[:heatmap_c] = (0.15, 0.5) # TODO: this should be replaced with a ColorGradient
# _seriesDefaults[:fill] = nothing # fills in the area
_seriesDefaults[:smooth] = false # regression line?
_seriesDefaults[:group] = nothing # groupby vector
_seriesDefaults[:annotation] = nothing # annotation tuple(s)... (x,y,annotation)
_seriesDefaults[:z] = nothing # depth for contour, color scale, etc
# _seriesDefaults[:args] = [] # additional args to pass to the backend
# _seriesDefaults[:kwargs] = [] # additional keyword args to pass to the backend
# # note: can be Vector{Dict} or Vector{Tuple}
_seriesDefaults[:surface] = nothing
_seriesDefaults[:nlevels] = 15
_seriesDefaults[:axis] = :left
_seriesDefaults[:label] = "AUTO"
_seriesDefaults[:linetype] = :path
_seriesDefaults[:linestyle] = :solid
_seriesDefaults[:linewidth] = 1
_seriesDefaults[:linecolor] = :auto
_seriesDefaults[:linealpha] = nothing
# _seriesDefaults[:linestroke] = Stroke(1, :auto, nothing, :solid) # linewidth, linecolor, linealpha, linestyle
# _seriesDefaults[:fillbrush] = Brush(nothing, :match, nothing) # fillrange, fillcolor, fillalpha
_seriesDefaults[:fillrange] = nothing # ribbons, areas, etc
_seriesDefaults[:fillcolor] = :match
_seriesDefaults[:fillalpha] = nothing
_seriesDefaults[:markershape] = :none
# _seriesDefaults[:markerstroke] = Stroke(1, :match_foreground, nothing, :solid)
# _seriesDefaults[:markerbrush] = Brush(6, :match, nothing)
_seriesDefaults[:markercolor] = :match
_seriesDefaults[:markeralpha] = nothing
_seriesDefaults[:markersize] = 6
_seriesDefaults[:markerstrokestyle] = :solid
_seriesDefaults[:markerstrokewidth] = 1
_seriesDefaults[:markerstrokecolor] = :match
_seriesDefaults[:markerstrokealpha] = nothing
# _seriesDefaults[:ribbon] = nothing
# _seriesDefaults[:ribboncolor] = :match
_seriesDefaults[:nbins] = 30 # number of bins for heatmaps and hists
_seriesDefaults[:smooth] = false # regression line?
_seriesDefaults[:group] = nothing # groupby vector
_seriesDefaults[:annotation] = nothing # annotation tuple(s)... (x,y,annotation)
_seriesDefaults[:z] = nothing # depth for contour, color scale, etc
_seriesDefaults[:z]
_seriesDefaults[:surface] = nothing
_seriesDefaults[:nlevels] = 15
const _plotDefaults = Dict{Symbol, Any}()
@ -185,12 +189,6 @@ supportedArgs(::PlottingPackage) = _allArgs
supportedArgs() = supportedArgs(backend())
@compat const _argNotes = Dict(
:color => "Series color. To have different marker and/or fill colors, optionally set the markercolor and fillcolor args.",
:z => "Determines the depth. For color gradients, we expect 0 ≤ z ≤ 1.",
# :heatmap_c => "For Qwt heatmaps only... will be deprecated eventually.",
)
# -----------------------------------------------------------------------------
@ -220,79 +218,88 @@ end
# Alternate args
@compat const _keyAliases = Dict(
:c => :color,
:lab => :label,
:l => :line,
:w => :linewidth,
:width => :linewidth,
:lw => :linewidth,
:lo => :lineopacity,
:type => :linetype,
:lt => :linetype,
:t => :linetype,
:style => :linestyle,
:s => :linestyle,
:ls => :linestyle,
:m => :marker,
:mark => :marker,
:shape => :markershape,
:mc => :markercolor,
:mcolor => :markercolor,
:ms => :markersize,
:msize => :markersize,
:mo => :markeropacity,
:opacity => :markeropacity,
:alpha => :markeropacity,
:f => :fill,
:area => :fill,
:fillrng => :fillrange,
:fc => :fillcolor,
:fcolor => :fillcolor,
:fo => :fillopacity,
:g => :group,
:nb => :nbins,
:nbin => :nbins,
:rib => :ribbon,
:ann => :annotation,
:anns => :annotation,
:annotate => :annotation,
:annotations => :annotation,
:xlab => :xlabel,
:ylab => :ylabel,
:yrlab => :yrightlabel,
:ylabr => :yrightlabel,
:y2lab => :yrightlabel,
:ylab2 => :yrightlabel,
:ylabelright => :yrightlabel,
:ylabel2 => :yrightlabel,
:y2label => :yrightlabel,
:leg => :legend,
:bg => :background_color,
:bgcolor => :background_color,
:bg_color => :background_color,
:background => :background_color,
:fg => :foreground_color,
:fgcolor => :foreground_color,
:fg_color => :foreground_color,
:foreground => :foreground_color,
:regression => :smooth,
:reg => :smooth,
:xlim => :xlims,
:xlimit => :xlims,
:xlimits => :xlims,
:ylim => :ylims,
:ylimit => :ylims,
:ylimits => :ylims,
:xtick => :xticks,
:ytick => :yticks,
:windowsize => :size,
:wsize => :size,
:wtitle => :windowtitle,
:gui => :show,
:display => :show,
:palette => :color_palette,
:xlink => :linkx,
:ylink => :linky,
:c => :linecolor,
:color => :linecolor,
:colour => :linecolor,
:lab => :label,
:l => :line,
:w => :linewidth,
:width => :linewidth,
:lw => :linewidth,
:la => :linealpha,
:lineopacity => :linealpha,
:type => :linetype,
:lt => :linetype,
:t => :linetype,
:style => :linestyle,
:s => :linestyle,
:ls => :linestyle,
:m => :marker,
:mark => :marker,
:shape => :markershape,
:mc => :markercolor,
:mcolor => :markercolor,
:markercolour => :markercolor,
:ms => :markersize,
:msize => :markersize,
:ma => :markeralpha,
:alpha => :markeralpha,
:opacity => :markeralpha,
:markeropacity => :markeralpha,
:f => :fill,
:area => :fill,
:fillrng => :fillrange,
:fc => :fillcolor,
:fcolor => :fillcolor,
:fillcolour => :fillcolor,
:fa => :fillalpha,
:fillopacity => :fillalpha,
:g => :group,
:nb => :nbins,
:nbin => :nbins,
:rib => :ribbon,
:ann => :annotation,
:anns => :annotation,
:annotate => :annotation,
:annotations => :annotation,
:xlab => :xlabel,
:ylab => :ylabel,
:yrlab => :yrightlabel,
:ylabr => :yrightlabel,
:y2lab => :yrightlabel,
:ylab2 => :yrightlabel,
:ylabelright => :yrightlabel,
:ylabel2 => :yrightlabel,
:y2label => :yrightlabel,
:leg => :legend,
:bg => :background_color,
:bgcolor => :background_color,
:bg_color => :background_color,
:background => :background_color,
:background_colour => :background_color,
:fg => :foreground_color,
:fgcolor => :foreground_color,
:fg_color => :foreground_color,
:foreground => :foreground_color,
:foreground_colour => :foreground_color,
:regression => :smooth,
:reg => :smooth,
:xlim => :xlims,
:xlimit => :xlims,
:xlimits => :xlims,
:ylim => :ylims,
:ylimit => :ylims,
:ylimits => :ylims,
:xtick => :xticks,
:ytick => :yticks,
:windowsize => :size,
:wsize => :size,
:wtitle => :windowtitle,
:gui => :show,
:display => :show,
:palette => :color_palette,
:xlink => :linkx,
:ylink => :linky,
)
# add all pluralized forms to the _keyAliases dict
@ -406,16 +413,27 @@ function processLineArg(d::Dict, arg)
elseif trueOrAllTrue(a -> get(_styleAliases, a, a) in _allStyles, arg)
d[:linestyle] = arg
elseif typeof(arg) <: Stroke
arg.width == nothing || (d[:linewidth] = arg.width)
arg.color == nothing || (d[:linecolor] = arg.color == :auto ? :auto : colorscheme(arg.color))
arg.alpha == nothing || (d[:linealpha] = arg.alpha)
arg.style == nothing || (d[:linestyle] = arg.style)
elseif typeof(arg) <: Brush
arg.size == nothing || (d[:fillrange] = arg.size)
arg.color == nothing || (d[:fillcolor] = arg.color == :auto ? :auto : colorscheme(arg.color))
arg.alpha == nothing || (d[:fillalpha] = arg.alpha)
# linewidth
elseif trueOrAllTrue(a -> typeof(a) <: Integer, arg)
d[:linewidth] = arg
# lineopacity
# linealpha
elseif trueOrAllTrue(a -> typeof(a) <: Real && a >= 0 && a <= 1, arg)
d[:lineopacity] = arg
d[:linealpha] = arg
# color
elseif !handleColors!(d, arg, :color)
elseif !handleColors!(d, arg, :linecolor)
warn("Skipped line arg $arg.")
end
@ -429,14 +447,29 @@ function processMarkerArg(d::Dict, arg)
d[:markershape] = arg
elseif trueOrAllTrue(a -> isa(a, Shape), arg)
d[:markershape] = arg
# stroke style
elseif trueOrAllTrue(a -> get(_styleAliases, a, a) in _allStyles, arg)
d[:markerstrokestyle] = arg
elseif typeof(arg) <: Stroke
arg.width == nothing || (d[:markerstrokewidth] = arg.width)
arg.color == nothing || (d[:markerstrokecolor] = arg.color == :auto ? :auto : colorscheme(arg.color))
arg.alpha == nothing || (d[:markerstrokealpha] = arg.alpha)
arg.style == nothing || (d[:markerstrokestyle] = arg.style)
elseif typeof(arg) <: Brush
arg.size == nothing || (d[:markersize] = arg.size)
arg.color == nothing || (d[:markercolor] = arg.color == :auto ? :auto : colorscheme(arg.color))
arg.alpha == nothing || (d[:markeralpha] = arg.alpha)
# markersize
elseif trueOrAllTrue(a -> typeof(a) <: Integer, arg)
d[:markersize] = arg
# lineopacity
# linealpha
elseif trueOrAllTrue(a -> typeof(a) <: Real && a >= 0 && a <= 1, arg)
d[:markeropacity] = arg
d[:markeralpha] = arg
# markercolor
elseif !handleColors!(d, arg, :markercolor)
@ -447,7 +480,13 @@ end
function processFillArg(d::Dict, arg)
if !handleColors!(d, arg, :fillcolor)
if typeof(arg) <: Brush
arg.size == nothing || (d[:fillrange] = arg.size)
arg.color == nothing || (d[:fillcolor] = arg.color == :auto ? :auto : colorscheme(arg.color))
arg.alpha == nothing || (d[:fillalpha] = arg.alpha)
elseif !handleColors!(d, arg, :fillcolor)
d[:fillrange] = arg
end
end
@ -488,6 +527,8 @@ function preprocessArgs!(d::Dict)
end
delete!(d, :fill)
# convert into strokes and brushes
# handle subplot links
if haskey(d, :link)
l = d[:link]
@ -628,7 +669,7 @@ end
# build the argument dictionary for a series
function getSeriesArgs(pkg::PlottingPackage, initargs::Dict, kw, commandIndex::Int, plotIndex::Int, globalIndex::Int) # TODO, pass in initargs, not plt
function getSeriesArgs(pkg::PlottingPackage, plotargs::Dict, kw, commandIndex::Int, plotIndex::Int, globalIndex::Int) # TODO, pass in plotargs, not plt
kwdict = Dict(kw)
d = Dict()
@ -653,17 +694,24 @@ function getSeriesArgs(pkg::PlottingPackage, initargs::Dict, kw, commandIndex::I
aliasesAndAutopick(d, :markershape, _markerAliases, supportedMarkers(pkg), plotIndex)
# update color
d[:color] = getSeriesRGBColor(d[:color], initargs, plotIndex)
d[:linecolor] = getSeriesRGBColor(d[:linecolor], plotargs, plotIndex)
# update markercolor
mc = d[:markercolor]
mc = (mc == :match ? d[:color] : getSeriesRGBColor(mc, initargs, plotIndex))
d[:markercolor] = mc
c = d[:markercolor]
c = (c == :match ? d[:linecolor] : getSeriesRGBColor(c, plotargs, plotIndex))
d[:markercolor] = c
# update markerstrokecolor
c = d[:markerstrokecolor]
c = (c == :match ? plotargs[:foreground_color] : getSeriesRGBColor(c, plotargs, plotIndex))
d[:markerstrokecolor] = c
# update fillcolor
mc = d[:fillcolor]
mc = (mc == :match ? d[:color] : getSeriesRGBColor(mc, initargs, plotIndex))
d[:fillcolor] = mc
c = d[:fillcolor]
c = (c == :match ? d[:linecolor] : getSeriesRGBColor(c, plotargs, plotIndex))
d[:fillcolor] = c
# TODO: rebuild
# set label
label = d[:label]

View File

@ -88,7 +88,7 @@ function _add_series(::BokehPackage, plt::Plot; kw...)
glyph = Bokeh.Bokehjs.Glyph(
glyphtype = bokeh_glyph_type(d),
linecolor = bokehcolor(d[:color]), # shape's stroke or line color
linecolor = bokehcolor(d[:linecolor]), # shape's stroke or line color
linewidth = d[:linewidth], # shape's stroke width or line width
fillcolor = bokehcolor(d[:markercolor]),
size = ceil(Int, d[:markersize] * 2.5), # magic number 2.5 to keep in same scale as other backends

View File

@ -36,9 +36,9 @@ function getLineGeom(d::Dict)
elseif lt == :steppre
Gadfly.Geom.step(direction = :vh)
elseif lt == :hline
Gadfly.Geom.hline(color = getColor(d[:color]), size = d[:linewidth] * Gadfly.px)
Gadfly.Geom.hline(color = getColor(d[:linecolor]), size = d[:linewidth] * Gadfly.px)
elseif lt == :vline
Gadfly.Geom.vline(color = getColor(d[:color]), size = d[:linewidth] * Gadfly.px)
Gadfly.Geom.vline(color = getColor(d[:linecolor]), size = d[:linewidth] * Gadfly.px)
elseif lt == :contour
Gadfly.Geom.contour(levels = d[:nlevels])
else
@ -46,24 +46,11 @@ function getLineGeom(d::Dict)
end
end
function getGadflyLineTheme(d::Dict)
lc = getColor(d[:color])
α = d[:lineopacity]
if α != nothing
lc = RGBA(lc, α)
end
fc = getColor(d[:fillcolor])
α = d[:fillopacity]
if α != nothing
fc = RGBA(fc, α)
end
function get_extra_theme_args(d::Dict, k::Symbol)
# gracefully handles old Gadfly versions
extra_theme_args = Dict()
try
extra_theme_args[:line_style] = Gadfly.get_stroke_vector(d[:linestyle])
extra_theme_args[:line_style] = Gadfly.get_stroke_vector(d[k])
catch err
if string(err) == "UndefVarError(:get_stroke_vector)"
Base.warn_once("Gadfly.get_stroke_vector failed... do you have an old version of Gadfly?")
@ -71,6 +58,23 @@ function getGadflyLineTheme(d::Dict)
rethrow()
end
end
extra_theme_args
end
function getGadflyLineTheme(d::Dict)
lc = getColor(d[:linecolor])
α = d[:linealpha]
if α != nothing
lc = RGBA(lc, α)
end
fc = getColor(d[:fillcolor])
α = d[:fillalpha]
if α != nothing
fc = RGBA(fc, α)
end
Gadfly.Theme(;
default_color = lc,
@ -79,7 +83,7 @@ function getGadflyLineTheme(d::Dict)
lowlight_color = x->RGB(fc), # fill/ribbon
lowlight_opacity = alpha(fc), # fill/ribbon
bar_highlight = RGB(lc), # bars
extra_theme_args...
get_extra_theme_args(d, :linestyle)...
)
end
@ -129,32 +133,33 @@ function getMarkerGeom(d::Dict)
end
function getGadflyMarkerTheme(d::Dict, initargs::Dict)
function getGadflyMarkerTheme(d::Dict, plotargs::Dict)
c = getColor(d[:markercolor])
α = d[:markeropacity]
α = d[:markeralpha]
if α != nothing
c = RGBA(RGB(c), α)
end
fg = getColor(initargs[:foreground_color])
Gadfly.Theme(
# fg = getColor(plotargs[:foreground_color])
Gadfly.Theme(;
default_color = c,
default_point_size = d[:markersize] * Gadfly.px,
discrete_highlight_color = c -> RGB(fg),
highlight_width = d[:linewidth] * Gadfly.px,
discrete_highlight_color = c -> RGB(getColor(d[:markerstrokecolor])),
highlight_width = d[:markerstrokewidth] * Gadfly.px,
# get_extra_theme_args(d, :markerstrokestyle)...
)
end
function addGadflyMarker!(plt::Plot, d::Dict, initargs::Dict, geoms...)
function addGadflyMarker!(plt::Plot, d::Dict, plotargs::Dict, geoms...)
gfargs = vcat(geoms...,
getGadflyMarkerTheme(d, initargs),
getGadflyMarkerTheme(d, plotargs),
getMarkerGeom(d))
kwargs = Dict()
# handle continuous color scales for the markers
z = d[:z]
if z != nothing && typeof(z) <: AVec
kwargs[:color] = z
kwargs[:linecolor] = z
if !isa(d[:markercolor], ColorGradient)
d[:markercolor] = colorscheme(:bluesreds)
end
@ -170,7 +175,7 @@ end
function addToGadflyLegend(plt::Plot, d::Dict)
# add the legend?
if plt.initargs[:legend]
if plt.plotargs[:legend]
gplt = getGadflyContext(plt)
# add the legend if needed
@ -185,7 +190,7 @@ function addToGadflyLegend(plt::Plot, d::Dict)
# since gadfly will call unique(colors), but doesn't also merge the rows that match
# Should ensure from this side that colors which are the same are merged together
c = getColor(d[d[:markershape] == :none ? :color : :markercolor])
c = getColor(d[d[:markershape] == :none ? :linecolor : :markercolor])
foundit = false
# extend the label if we found this color
@ -239,7 +244,7 @@ function addGadflySeries!(plt::Plot, d::Dict)
# markers
if d[:markershape] != :none
prepend!(layers, addGadflyMarker!(plt, d, plt.initargs, smooth...))
prepend!(layers, addGadflyMarker!(plt, d, plt.plotargs, smooth...))
end
lt in (:hist, :heatmap, :hexbin, :contour) || addToGadflyLegend(plt, d)
@ -258,7 +263,7 @@ end
# z = d[:z]
# # handle line segments of different colors
# cscheme = d[:color]
# cscheme = d[:linecolor]
# if isa(cscheme, ColorVector)
# # create a color scale, and set the color group to the index of the color
# push!(gplt.scales, Gadfly.Scale.color_discrete_manual(cscheme.v...))
@ -270,7 +275,7 @@ end
# cs = collect(repmat(csindices', 2, 1))[1:end-1]
# grp = collect(repmat((1:length(d[:y]))', 2, 1))[1:end-1]
# d[:x], d[:y] = map(createSegments, (d[:x], d[:y]))
# colorgroup = [(:color, cs), (:group, grp)]
# colorgroup = [(:linecolor, cs), (:group, grp)]
# ---------------------------------------------------------------------------
@ -416,9 +421,9 @@ end
function updateGadflyPlotTheme(plt::Plot, d::Dict)
kwargs = Dict()
# # get the full initargs, overriding any new settings
# # get the full plotargs, overriding any new settings
# # TODO: should this be part of the main `plot` command in plot.jl???
# d = merge!(plt.initargs, d)
# d = merge!(plt.plotargs, d)
# hide the legend?
if !get(d, :legend, true)
@ -582,8 +587,8 @@ function buildGadflySubplotContext(subplt::Subplot)
end
setGadflyDisplaySize(w,h) = Compose.set_default_graphic_size(w * Compose.px, h * Compose.px)
setGadflyDisplaySize(plt::Plot) = setGadflyDisplaySize(plt.initargs[:size]...)
setGadflyDisplaySize(subplt::Subplot) = setGadflyDisplaySize(getinitargs(subplt, 1)[:size]...)
setGadflyDisplaySize(plt::Plot) = setGadflyDisplaySize(plt.plotargs[:size]...)
setGadflyDisplaySize(subplt::Subplot) = setGadflyDisplaySize(getplotargs(subplt, 1)[:size]...)
# -------------------------------------------------------------------------
@ -610,14 +615,14 @@ end
function Base.display(::PlotsDisplay, plt::Plot{GadflyPackage})
setGadflyDisplaySize(plt.initargs[:size]...)
setGadflyDisplaySize(plt.plotargs[:size]...)
display(plt.o)
end
function Base.display(::PlotsDisplay, subplt::Subplot{GadflyPackage})
setGadflyDisplaySize(getinitargs(subplt,1)[:size]...)
setGadflyDisplaySize(getplotargs(subplt,1)[:size]...)
ctx = buildGadflySubplotContext(subplt)

View File

@ -74,7 +74,7 @@ end
function showSubplotObject(subplt::Subplot{ImmersePackage})
# create the Gtk window with vertical box vsep
d = getinitargs(subplt,1)
d = getplotargs(subplt,1)
w,h = d[:size]
vsep = Gtk.GtkBoxLeaf(:v)
win = Gtk.GtkWindowLeaf(vsep, d[:windowtitle], w, h)
@ -137,7 +137,7 @@ function Base.display(::PlotsDisplay, plt::Plot{ImmersePackage})
fig, gplt = plt.o
if fig == nothing
fig = createImmerseFigure(plt.initargs)
fig = createImmerseFigure(plt.plotargs)
Gtk.on_signal_destroy((x...) -> (Immerse.dropfig(Immerse._display, fig.figno); plt.o = (nothing,gplt)), fig.canvas)
plt.o = (fig, gplt)
end

View File

@ -107,7 +107,7 @@ function getPyPlotFunction(plt::Plot, axis::Symbol, linetype::Symbol)
# in the 2-axis case we need to get: <rightaxis>[:<func>]
ax = getAxis(plt, axis)
ax[:set_ylabel](plt.initargs[:yrightlabel])
ax[:set_ylabel](plt.plotargs[:yrightlabel])
fmap = @compat Dict(
:hist => :hist,
:sticks => :bar,
@ -140,7 +140,7 @@ function handleSmooth(plt::Plot{PyPlotPackage}, ax, d::Dict, smooth::Bool)
xs, ys = regressionXY(d[:x], d[:y])
ax[:plot](xs, ys,
# linestyle = getPyPlotLineStyle(:path, :dashdot),
color = getPyPlotColor(d[:color]),
color = getPyPlotColor(d[:linecolor]),
linewidth = 2
)
end
@ -202,7 +202,7 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...)
error("linetype $(lt) is unsupported in PyPlot. Choose from: $(supportedTypes(pkg))")
end
color = getPyPlotColor(d[:color], d[:lineopacity])
color = getPyPlotColor(d[:linecolor], d[:linealpha])
if lt == :sticks
@ -243,10 +243,10 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...)
elseif lt in (:heatmap, :hexbin)
extra_kwargs[:gridsize] = d[:nbins]
extra_kwargs[:cmap] = getPyPlotColorMap(d[:color])
extra_kwargs[:cmap] = getPyPlotColorMap(d[:linecolor])
elseif lt == :contour
extra_kwargs[:cmap] = getPyPlotColorMap(d[:color])
extra_kwargs[:cmap] = getPyPlotColorMap(d[:linecolor])
extra_kwargs[:linewidths] = d[:linewidth]
extra_kwargs[:linestyles] = getPyPlotLineStyle(lt, d[:linestyle])
# TODO: will need to call contourf to fill in the contours
@ -261,14 +261,14 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...)
c = d[:markercolor]
if isa(c, ColorGradient) && d[:z] != nothing
extra_kwargs[:c] = convert(Vector{Float64}, d[:z])
extra_kwargs[:cmap] = getPyPlotColorMap(c, d[:markeropacity])
extra_kwargs[:cmap] = getPyPlotColorMap(c, d[:markeralpha])
else
extra_kwargs[:c] = getPyPlotColor(c, d[:markeropacity])
extra_kwargs[:c] = getPyPlotColor(c, d[:markeralpha])
end
else
extra_kwargs[:markersize] = d[:markersize]
extra_kwargs[:markerfacecolor] = getPyPlotColor(d[:markercolor], d[:markeropacity])
extra_kwargs[:markeredgecolor] = getPyPlotColor(plt.initargs[:foreground_color])
extra_kwargs[:markerfacecolor] = getPyPlotColor(d[:markercolor], d[:markeralpha])
extra_kwargs[:markeredgecolor] = getPyPlotColor(plt.plotargs[:foreground_color])
extra_kwargs[:markeredgewidth] = d[:linewidth]
extra_kwargs[:drawstyle] = getPyPlotStepStyle(lt)
end
@ -276,7 +276,7 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...)
# set these for all types
if lt != :contour
extra_kwargs[:color] = color
extra_kwargs[:linecolor] = color
extra_kwargs[:linewidth] = d[:linewidth]
extra_kwargs[:label] = d[:label]
end
@ -291,7 +291,7 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...)
surf = d[:surface]'
handle = plotfunc(x, y, surf, d[:nlevels]; extra_kwargs...)
if d[:fillrange] != nothing
handle = ax[:contourf](x, y, surf, d[:nlevels]; cmap = getPyPlotColorMap(d[:fillcolor], d[:fillopacity]))
handle = ax[:contourf](x, y, surf, d[:nlevels]; cmap = getPyPlotColorMap(d[:fillcolor], d[:fillalpha]))
end
handle
elseif lt in _3dTypes
@ -305,16 +305,16 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...)
handleSmooth(plt, ax, d, d[:smooth])
# add the colorbar legend
if plt.initargs[:legend] && haskey(extra_kwargs, :cmap)
if plt.plotargs[:legend] && haskey(extra_kwargs, :cmap)
PyPlot.colorbar(d[:serieshandle])
end
# this sets the bg color inside the grid
ax[:set_axis_bgcolor](getPyPlotColor(plt.initargs[:background_color]))
ax[:set_axis_bgcolor](getPyPlotColor(plt.plotargs[:background_color]))
fillrange = d[:fillrange]
if fillrange != nothing && lt != :contour
fillcolor = getPyPlotColor(d[:fillcolor], d[:fillopacity])
fillcolor = getPyPlotColor(d[:fillcolor], d[:fillalpha])
if typeof(fillrange) <: @compat(Union{Real, AVec})
ax[:fill_between](d[:x], fillrange, d[:y], facecolor = fillcolor)
else
@ -351,11 +351,11 @@ function Base.setindex!(plt::Plot{PyPlotPackage}, xy::Tuple, i::Integer)
end
ax = series[:axes]
if plt.initargs[:xlims] == :auto
if plt.plotargs[:xlims] == :auto
xmin, xmax = ax[:get_xlim]()
ax[:set_xlim](min(xmin, minimum(xy[1])), max(xmax, maximum(xy[1])))
end
if plt.initargs[:ylims] == :auto
if plt.plotargs[:ylims] == :auto
ymin, ymax = ax[:get_ylim]()
ax[:set_ylim](min(ymin, minimum(xy[2])), max(ymax, maximum(xy[2])))
end
@ -443,13 +443,13 @@ function _update_plot(plt::Plot{PyPlotPackage}, d::Dict)
# guides
sz = get(d, :guidefont, plt.initargs[:guidefont]).pointsize
sz = get(d, :guidefont, plt.plotargs[:guidefont]).pointsize
ax[:title][:set_fontsize](sz)
ax[:xaxis][:label][:set_fontsize](sz)
ax[:yaxis][:label][:set_fontsize](sz)
# ticks
sz = get(d, :tickfont, plt.initargs[:tickfont]).pointsize
sz = get(d, :tickfont, plt.plotargs[:tickfont]).pointsize
for sym in (:get_xticklabels, :get_yticklabels)
for lab in ax[sym]()
lab[:set_fontsize](sz)
@ -508,8 +508,8 @@ end
function _create_subplot(subplt::Subplot{PyPlotPackage}, isbefore::Bool)
l = subplt.layout
w,h = map(px2inch, getinitargs(subplt,1)[:size])
bgcolor = getPyPlotColor(getinitargs(subplt,1)[:background_color])
w,h = map(px2inch, getplotargs(subplt,1)[:size])
bgcolor = getPyPlotColor(getplotargs(subplt,1)[:background_color])
fig = PyPlot.figure(; figsize = (w,h), facecolor = bgcolor, dpi = 96)
nr = nrows(l)
@ -536,7 +536,7 @@ function subplot(plts::AVec{Plot{PyPlotPackage}}, layout::SubplotLayout, d::Dict
n = sum([plt.n for plt in plts])
pkg = PyPlotPackage()
newplts = Plot{PyPlotPackage}[plot(pkg; subplot=true, plt.initargs...) for plt in plts]
newplts = Plot{PyPlotPackage}[plot(pkg; subplot=true, plt.plotargs...) for plt in plts]
subplt = Subplot(nothing, newplts, PyPlotPackage(), p, n, layout, d, true, false, false, (r,c) -> (nothing,nothing))
@ -572,14 +572,14 @@ end
# function addPyPlotLegend(plt::Plot)
function addPyPlotLegend(plt::Plot, ax)
if plt.initargs[:legend]
if plt.plotargs[:legend]
# gotta do this to ensure both axes are included
args = filter(x -> !(x[:linetype] in (:hist,:hexbin,:heatmap,:hline,:vline,:contour, :path3d, :scatter3d)), plt.seriesargs)
if length(args) > 0
ax[:legend]([d[:serieshandle] for d in args],
[d[:label] for d in args],
loc="best",
fontsize = plt.initargs[:legendfont].pointsize
fontsize = plt.plotargs[:legendfont].pointsize
# framealpha = 0.6
)
end
@ -589,7 +589,7 @@ end
function finalizePlot(plt::Plot{PyPlotPackage})
ax = getLeftAxis(plt)
addPyPlotLegend(plt, ax)
updateAxisColors(ax, getPyPlotColor(plt.initargs[:foreground_color]))
updateAxisColors(ax, getPyPlotColor(plt.plotargs[:foreground_color]))
PyPlot.draw()
end
@ -598,7 +598,7 @@ function finalizePlot(subplt::Subplot{PyPlotPackage})
for (i,plt) in enumerate(subplt.plts)
ax = getLeftAxis(plt)
addPyPlotLegend(plt, ax)
updateAxisColors(ax, getPyPlotColor(plt.initargs[:foreground_color]))
updateAxisColors(ax, getPyPlotColor(plt.plotargs[:foreground_color]))
end
PyPlot.draw()
end

View File

@ -154,7 +154,7 @@ function addLineMarker(plt::Plot{QwtPackage}, d::Dict)
ishorizontal = (d[:linetype] == :hline)
marker[:setLineStyle](ishorizontal ? 1 : 2)
marker[ishorizontal ? :setYValue : :setXValue](yi)
qcolor = Qwt.convertRGBToQColor(getColor(d[:color]))
qcolor = Qwt.convertRGBToQColor(getColor(d[:linecolor]))
linestyle = plt.o.widget[:getLineStyle](string(d[:linestyle]))
marker[:setLinePen](Qwt.QT.QPen(qcolor, d[:linewidth], linestyle))
marker[:attach](plt.o.widget)
@ -228,7 +228,7 @@ function _create_subplot(subplt::Subplot{QwtPackage}, isbefore::Bool)
# i += rowcnt
# end
subplt.o = Qwt.vsplitter(rows...)
# Qwt.resizewidget(subplt.o, getinitargs(subplt,1)[:size]...)
# Qwt.resizewidget(subplt.o, getplotargs(subplt,1)[:size]...)
# Qwt.moveToLastScreen(subplt.o) # hack so it goes to my center monitor... sorry
true
end

View File

@ -3,11 +3,11 @@ supportedArgs(::GadflyPackage) = [
:annotation,
# :axis,
:background_color,
:color,
:linecolor,
:color_palette,
:fillrange,
:fillcolor,
:fillopacity,
:fillalpha,
:foreground_color,
:group,
:label,
@ -16,11 +16,14 @@ supportedArgs(::GadflyPackage) = [
:linestyle,
:linetype,
:linewidth,
:lineopacity,
:linealpha,
:markershape,
:markercolor,
:markersize,
:markeropacity,
:markeralpha,
:markerstrokewidth,
:markerstrokecolor,
# :markerstrokestyle,
:n,
:nbins,
:nc,
@ -77,7 +80,7 @@ supportedArgs(::PyPlotPackage) = [
:annotation,
:axis,
:background_color,
:color,
:linecolor,
:color_palette,
:fillrange,
:fillcolor,
@ -92,6 +95,9 @@ supportedArgs(::PyPlotPackage) = [
:markershape,
:markercolor,
:markersize,
# :markerstrokewidth,
# :markerstrokecolor,
# :markerstrokestyle,
:n,
:nbins,
:nc,
@ -123,9 +129,9 @@ supportedArgs(::PyPlotPackage) = [
:grid,
:surface,
:nlevels,
:fillopacity,
:lineopacity,
:markeropacity,
:fillalpha,
:linealpha,
:markeralpha,
]
supportedAxes(::PyPlotPackage) = _allAxes
supportedTypes(::PyPlotPackage) = [:none, :line, :path, :steppre, :steppost, :sticks, :scatter, :heatmap, :hexbin, :hist, :bar, :hline, :vline, :contour, :path3d, :scatter3d]
@ -145,7 +151,7 @@ supportedArgs(::QwtPackage) = [
# :args,
:axis,
:background_color,
:color,
:linecolor,
:color_palette,
:fillrange,
:fillcolor,
@ -162,6 +168,9 @@ supportedArgs(::QwtPackage) = [
:markershape,
:markercolor,
:markersize,
# :markerstrokewidth,
# :markerstrokecolor,
# :markerstrokestyle,
:n,
:nbins,
:nc,
@ -201,7 +210,7 @@ supportedArgs(::UnicodePlotsPackage) = [
# :args,
# :axis,
# :background_color,
# :color,
# :linecolor,
# :fill,
# :foreground_color,
:group,
@ -216,6 +225,9 @@ supportedArgs(::UnicodePlotsPackage) = [
:markershape,
# :markercolor,
# :markersize,
# :markerstrokewidth,
# :markerstrokecolor,
# :markerstrokestyle,
# :n,
:nbins,
# :nc,
@ -259,7 +271,7 @@ supportedArgs(::WinstonPackage) = [
# :args,
# :axis,
# :background_color,
:color,
:linecolor,
:color_palette,
:fillrange,
:fillcolor,
@ -276,6 +288,9 @@ supportedArgs(::WinstonPackage) = [
:markershape,
:markercolor,
:markersize,
# :markerstrokewidth,
# :markerstrokecolor,
# :markerstrokestyle,
# :n,
:nbins,
# :nc,
@ -318,11 +333,11 @@ supportedArgs(::BokehPackage) = [
# :annotation,
# :axis,
# :background_color,
:color,
:linecolor,
# :color_palette,
# :fillrange,
# :fillcolor,
# :fillopacity,
# :fillalpha,
# :foreground_color,
:group,
# :label,
@ -331,11 +346,14 @@ supportedArgs(::BokehPackage) = [
:linestyle,
:linetype,
:linewidth,
# :lineopacity,
# :linealpha,
:markershape,
:markercolor,
:markersize,
# :markeropacity,
# :markeralpha,
# :markerstrokewidth,
# :markerstrokecolor,
# :markerstrokestyle,
# :n,
# :nbins,
# :nc,

View File

@ -9,7 +9,7 @@ function rebuildUnicodePlot!(plt::Plot)
# figure out the plotting area xlim = [xmin, xmax] and ylim = [ymin, ymax]
sargs = plt.seriesargs
iargs = plt.initargs
iargs = plt.plotargs
# get the x/y limits
if get(iargs, :xlims, :auto) == :auto
@ -97,7 +97,7 @@ function addUnicodeSeries!(o, d::Dict, addlegend::Bool, xlim, ylim)
label = addlegend ? d[:label] : ""
# if we happen to pass in allowed color symbols, great... otherwise let UnicodePlots decide
color = d[:color] in UnicodePlots.autoColors ? d[:color] : :auto
color = d[:linecolor] in UnicodePlots.autoColors ? d[:linecolor] : :auto
# add the series
func(o, x, y; color = color, name = label, style = stepstyle)
@ -116,8 +116,8 @@ function _create_plot(pkg::UnicodePlotsPackage; kw...)
plt = Plot(nothing, pkg, 0, Dict(kw), Dict[])
# do we want to give a new default size?
if !haskey(plt.initargs, :size) || plt.initargs[:size] == _plotDefaults[:size]
plt.initargs[:size] = (60,20)
if !haskey(plt.plotargs, :size) || plt.plotargs[:size] == _plotDefaults[:size]
plt.plotargs[:size] = (60,20)
end
plt
@ -138,7 +138,7 @@ end
function _update_plot(plt::Plot{UnicodePlotsPackage}, d::Dict)
for k in (:title, :xlabel, :ylabel, :xlims, :ylims)
if haskey(d, k)
plt.initargs[k] = d[k]
plt.plotargs[k] = d[k]
end
end
end

View File

@ -68,7 +68,7 @@ function _add_series(::WinstonPackage, plt::Plot; kw...)
e = Dict()
e[:color] = getColor(d[:color])
e[:color] = getColor(d[:linecolor])
e[:linewidth] = d[:linewidth]
e[:kind] = winston_linestyle[d[:linestyle]]
e[:symbolkind] = winston_marker[d[:markershape]]
@ -198,7 +198,7 @@ end
# ----------------------------------------------------------------
function addWinstonLegend(plt::Plot, wplt)
if plt.initargs[:legend]
if plt.plotargs[:legend]
Winston.legend(wplt, [sd[:label] for sd in plt.seriesargs])
end
end
@ -219,9 +219,9 @@ function Base.display(::PlotsDisplay, plt::Plot{WinstonPackage})
error("Gtk is the only supported display for Winston in Plots. Set `output_surface = gtk` in src/Winston.ini")
end
# initialize window
w,h = plt.initargs[:size]
w,h = plt.plotargs[:size]
canvas = Gtk.GtkCanvasLeaf()
window = Gtk.GtkWindowLeaf(canvas, plt.initargs[:windowtitle], w, h)
window = Gtk.GtkWindowLeaf(canvas, plt.plotargs[:windowtitle], w, h)
plt.o = (window, canvas, wplt)
end

View File

@ -353,10 +353,10 @@ function handlePlotColors(::PlottingPackage, d::Dict)
end
# converts a symbol or string into a colorant (Colors.RGB), and assigns a color automatically
function getSeriesRGBColor(c, initargs::Dict, n::Int)
function getSeriesRGBColor(c, plotargs::Dict, n::Int)
if c == :auto
c = autopick(initargs[:color_palette], n)
c = autopick(plotargs[:color_palette], n)
end
# c should now be a subtype of ColorScheme

View File

@ -136,17 +136,21 @@ end
# -----------------------------------------------------------------------
immutable Stroke{T<:Real, C<:ColorScheme}
width::T
color::C
style::Symbol
immutable Stroke
width
color
alpha
style
end
function stroke(args...; α::Real = -1.0)
function stroke(args...; alpha = nothing)
# defaults
width = 1
color = colorant"black"
style = :solid
# width = 1
# color = colorant"black"
# style = :solid
width = nothing
color = nothing
style = nothing
for arg in args
T = typeof(arg)
@ -166,10 +170,54 @@ function stroke(args...; α::Real = -1.0)
end
end
Stroke(width, color, style)
Stroke(width, color, alpha, style)
end
immutable Brush
size # fillrange, markersize, or any other sizey attribute
color
alpha
end
function brush(args...; alpha = nothing)
# defaults
# sz = 1
# color = colorant"black"
size = nothing
color = nothing
for arg in args
T = typeof(arg)
if T <: Colorant
color = arg
elseif T <: @compat Union{Symbol,AbstractString}
try
color = parse(Colorant, string(arg))
end
elseif typeof(arg) <: Real
size = arg
else
warn("Unused brush arg: $arg ($(typeof(arg)))")
end
end
Brush(size, color, alpha)
end
# -----------------------------------------------------------------------
"type which represents z-values for colors and sizes (and anything else that might come up)"
immutable ZValues
values::Vector{Float64}
zrange::Tuple{Float64,Float64}
end
function zvalues{T<:Real}(values::AVec{T}, zrange::Tuple{T,T} = (minimum(values), maximum(values)))
ZValues(collect(float(values)), map(Float64, zrange))
end
# -----------------------------------------------------------------------
type OHLC{T<:Real}

View File

@ -22,7 +22,7 @@ Base.print(io::IO, plt::Plot) = print(io, string(plt))
Base.show(io::IO, plt::Plot) = print(io, string(plt))
getplot(plt::Plot) = plt
getinitargs(plt::Plot, idx::Int = 1) = plt.initargs
getplotargs(plt::Plot, idx::Int = 1) = plt.plotargs
convertSeriesIndex(plt::Plot, n::Int) = n
# ---------------------------------------------------------
@ -94,8 +94,8 @@ function plot!(plt::Plot, args...; kw...)
# if we were able to extract guide information from the series inputs, then update the plot
# @show xmeta, ymeta
updateDictWithMeta(d, plt.initargs, xmeta, true)
updateDictWithMeta(d, plt.initargs, ymeta, false)
updateDictWithMeta(d, plt.plotargs, xmeta, true)
updateDictWithMeta(d, plt.plotargs, ymeta, false)
# now we can plot the series
for (i,di) in enumerate(seriesArgList)
@ -121,9 +121,9 @@ function plot!(plt::Plot, args...; kw...)
# add title, axis labels, ticks, etc
if !haskey(d, :subplot)
merge!(plt.initargs, d)
dumpdict(plt.initargs, "Updating plot items")
_update_plot(plt, plt.initargs)
merge!(plt.plotargs, d)
dumpdict(plt.plotargs, "Updating plot items")
_update_plot(plt, plt.plotargs)
end
_update_plot_pos_size(plt, d)
@ -168,13 +168,13 @@ _before_add_series(plt::Plot) = nothing
# --------------------------------------------------------------------
# should we update the x/y label given the meta info during input slicing?
function updateDictWithMeta(d::Dict, initargs::Dict, meta::Symbol, isx::Bool)
function updateDictWithMeta(d::Dict, plotargs::Dict, meta::Symbol, isx::Bool)
lsym = isx ? :xlabel : :ylabel
if initargs[lsym] == default(lsym)
if plotargs[lsym] == default(lsym)
d[lsym] = string(meta)
end
end
updateDictWithMeta(d::Dict, initargs::Dict, meta, isx::Bool) = nothing
updateDictWithMeta(d::Dict, plotargs::Dict, meta, isx::Bool) = nothing
# --------------------------------------------------------------------
@ -275,7 +275,7 @@ function createKWargsList(plt::PlottingObject, x, y; kw...)
numUncounted = get(d, :numUncounted, 0)
n = plt.n + i + numUncounted
dumpdict(d, "before getSeriesArgs")
d = getSeriesArgs(plt.backend, getinitargs(plt, n), d, i + numUncounted, convertSeriesIndex(plt, n), n)
d = getSeriesArgs(plt.backend, getplotargs(plt, n), d, i + numUncounted, convertSeriesIndex(plt, n), n)
dumpdict(d, "after getSeriesArgs")
d[:x], d[:y] = computeXandY(xs[mod1(i,mx)], ys[mod1(i,my)])
@ -363,7 +363,7 @@ end
# special handling... xmin/xmax with function(s)
function createKWargsList(plt::PlottingObject, f::FuncOrFuncs, xmin::Real, xmax::Real; kw...)
width = plt.initargs[:size][1]
width = plt.plotargs[:size][1]
x = collect(linspace(xmin, xmax, width)) # we don't need more than the width
createKWargsList(plt, x, f; kw...)
end

View File

@ -128,7 +128,7 @@ Base.print(io::IO, subplt::Subplot) = print(io, string(subplt))
Base.show(io::IO, subplt::Subplot) = print(io, string(subplt))
getplot(subplt::Subplot, idx::Int = subplt.n) = subplt.plts[mod1(idx, subplt.p)]
getinitargs(subplt::Subplot, idx::Int) = getplot(subplt, idx).initargs
getplotargs(subplt::Subplot, idx::Int) = getplot(subplt, idx).plotargs
convertSeriesIndex(subplt::Subplot, n::Int) = ceil(Int, n / subplt.p)
# ------------------------------------------------------------
@ -225,19 +225,19 @@ function _preprocess_subplot(subplt::Subplot, d::Dict)
preprocessArgs!(d)
dumpdict(d, "After subplot! preprocessing")
# get the full initargs, overriding any new settings
# TODO: subplt.initargs should probably be merged sooner and actually used
# get the full plotargs, overriding any new settings
# TODO: subplt.plotargs should probably be merged sooner and actually used
# for color selection, etc. (i.e. if we overwrite the subplot palettes to [:heat :rainbow])
# then we need to overwrite plt[1].initargs[:color_palette] to :heat before it's actually used
# then we need to overwrite plt[1].plotargs[:color_palette] to :heat before it's actually used
# for color selection!
# first merge the new args into the subplot's initargs. then process the plot args and merge
# those into the plot's initargs. (example... `palette = [:blues :reds]` goes into subplt.initargs,
# then the ColorGradient for :blues/:reds is merged into plot 1/2 initargs, which is then used for color selection)
# first merge the new args into the subplot's plotargs. then process the plot args and merge
# those into the plot's plotargs. (example... `palette = [:blues :reds]` goes into subplt.plotargs,
# then the ColorGradient for :blues/:reds is merged into plot 1/2 plotargs, which is then used for color selection)
for i in 1:length(subplt.layout)
subplt.plts[i].initargs = getPlotArgs(backend(), merge(subplt.plts[i].initargs, d), i)
subplt.plts[i].plotargs = getPlotArgs(backend(), merge(subplt.plts[i].plotargs, d), i)
end
merge!(subplt.initargs, d)
merge!(subplt.plotargs, d)
# process links. TODO: extract to separate function
for s in (:linkx, :linky, :linkfunc)
@ -256,7 +256,7 @@ function _postprocess_subplot(subplt::Subplot, d::Dict)
# add title, axis labels, ticks, etc
for (i,plt) in enumerate(subplt.plts)
di = plt.initargs
di = plt.plotargs
dumpdict(di, "Updating sp $i")
_update_plot(plt, di)
end
@ -333,7 +333,7 @@ function subplot!(subplt::Subplot, args...; kw...)
delete!(di, k)
end
dumpdict(di, "subplot! kwList $i")
dumpdict(plt.initargs, "plt.initargs before plotting")
dumpdict(plt.plotargs, "plt.plotargs before plotting")
_add_series_subplot(plt; di...)
end

View File

@ -13,7 +13,7 @@ type Plot{T<:PlottingPackage} <: PlottingObject{T}
n::Int # number of series
# store these just in case
initargs::Dict
plotargs::Dict
seriesargs::Vector{Dict} # args for each series
end
@ -38,8 +38,8 @@ type Subplot{T<:PlottingPackage, L<:SubplotLayout} <: PlottingObject{T}
p::Int # number of plots
n::Int # number of series
layout::L
# initargs::Vector{Dict}
initargs::Dict
# plotargs::Vector{Dict}
plotargs::Dict
initialized::Bool
linkx::Bool
linky::Bool