working on pyplot refactor; path/scatter in 2d/3d done
This commit is contained in:
parent
b9818a4480
commit
6161b08f82
@ -826,7 +826,7 @@ function getSeriesArgs(pkg::AbstractBackend, plotargs::KW, kw, commandIndex::Int
|
|||||||
d[:markerstrokecolor] = c
|
d[:markerstrokecolor] = c
|
||||||
|
|
||||||
# update alphas
|
# update alphas
|
||||||
for asym in (:linealpha, :markeralpha, :fillalpha)
|
for asym in (:linealpha, :markeralpha, :markerstrokealpha, :fillalpha)
|
||||||
if d[asym] == nothing
|
if d[asym] == nothing
|
||||||
d[asym] = d[:seriesalpha]
|
d[asym] = d[:seriesalpha]
|
||||||
end
|
end
|
||||||
|
|||||||
@ -325,7 +325,7 @@ end
|
|||||||
|
|
||||||
# total hack due to PyPlot bug (see issue #145).
|
# total hack due to PyPlot bug (see issue #145).
|
||||||
# hack: duplicate the color vector when the total rgba fields is the same as the series length
|
# hack: duplicate the color vector when the total rgba fields is the same as the series length
|
||||||
function color_fix(c)
|
function color_fix(c, x)
|
||||||
if (typeof(c) <: AbstractArray && length(c)*4 == length(x)) ||
|
if (typeof(c) <: AbstractArray && length(c)*4 == length(x)) ||
|
||||||
(typeof(c) <: Tuple && length(x) == 4)
|
(typeof(c) <: Tuple && length(x) == 4)
|
||||||
vcat(c, c)
|
vcat(c, c)
|
||||||
@ -392,18 +392,17 @@ function _add_series(pkg::PyPlotBackend, plt::Plot, d::KW)
|
|||||||
# :shape => :add_patch,
|
# :shape => :add_patch,
|
||||||
#
|
#
|
||||||
# do the plotting
|
# do the plotting
|
||||||
if lt in (:path, :line, :scatter)
|
|
||||||
|
# path/line/scatter should all do UP TO 2 series... a line, and a scatter
|
||||||
|
if lt in (:path, :line, :scatter, :path3d, :scatter3d)
|
||||||
|
xyargs = (lt in _3dTypes ? (x,y,z) : (x,y))
|
||||||
|
|
||||||
if d[:linewidth] > 0
|
if d[:linewidth] > 0
|
||||||
d[:serieshandle] = ax[:plot](x, y;
|
d[:serieshandle] = ax[:plot](xyargs...;
|
||||||
color = pylinecolor(d),
|
color = pylinecolor(d),
|
||||||
linewidth = d[:linewidth],
|
linewidth = d[:linewidth],
|
||||||
linestyle = getPyPlotLineStyle(lt, d[:linestyle]),
|
linestyle = getPyPlotLineStyle(lt, d[:linestyle]),
|
||||||
drawstyle = getPyPlotStepStyle(lt),
|
drawstyle = getPyPlotStepStyle(lt),
|
||||||
# marker = markershape,
|
|
||||||
# markersize = d[:markersize],
|
|
||||||
# markerfacecolor = markercolor,
|
|
||||||
# markeredgecolor = strokecolor,
|
|
||||||
# markeredgewidth = d[:markerstrokewidth],
|
|
||||||
label = d[:label],
|
label = d[:label],
|
||||||
zorder = plt.n
|
zorder = plt.n
|
||||||
)
|
)
|
||||||
@ -411,12 +410,12 @@ function _add_series(pkg::PyPlotBackend, plt::Plot, d::KW)
|
|||||||
|
|
||||||
if d[:markershape] != :none
|
if d[:markershape] != :none
|
||||||
if d[:marker_z] == nothing
|
if d[:marker_z] == nothing
|
||||||
extrakw[:c] = color_fix(pymarkercolor(d))
|
extrakw[:c] = color_fix(pymarkercolor(d), x)
|
||||||
else
|
else
|
||||||
extrakw[:c] = convert(Vector{Float64}, d[:marker_z])
|
extrakw[:c] = convert(Vector{Float64}, d[:marker_z])
|
||||||
extrakw[:cmap] = pymarkercolormap(d)
|
extrakw[:cmap] = pymarkercolormap(d)
|
||||||
end
|
end
|
||||||
d[:serieshandle] = ax[:scatter](x, y;
|
d[:serieshandle] = ax[:scatter](xyargs...;
|
||||||
marker = getPyPlotMarker(d[:markershape]),
|
marker = getPyPlotMarker(d[:markershape]),
|
||||||
s = d[:markersize] .^ 2,
|
s = d[:markersize] .^ 2,
|
||||||
edgecolors = pymarkerstrokecolor(d),
|
edgecolors = pymarkerstrokecolor(d),
|
||||||
@ -426,7 +425,6 @@ function _add_series(pkg::PyPlotBackend, plt::Plot, d::KW)
|
|||||||
extrakw...
|
extrakw...
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# smoothing
|
# smoothing
|
||||||
@ -712,6 +710,9 @@ end
|
|||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# TODO: d[:serieshandle] should really be a list of handles... then we should set
|
||||||
|
# the x/y data for each handle (for example, plot and scatter)
|
||||||
|
|
||||||
function setxy!{X,Y}(plt::Plot{PyPlotBackend}, xy::Tuple{X,Y}, i::Integer)
|
function setxy!{X,Y}(plt::Plot{PyPlotBackend}, xy::Tuple{X,Y}, i::Integer)
|
||||||
d = plt.seriesargs[i]
|
d = plt.seriesargs[i]
|
||||||
d[:x], d[:y] = xy
|
d[:x], d[:y] = xy
|
||||||
|
|||||||
@ -25,6 +25,7 @@ supportedArgs(::GadflyBackend) = [
|
|||||||
:group,
|
:group,
|
||||||
:label,
|
:label,
|
||||||
:linetype,
|
:linetype,
|
||||||
|
:seriescolor, :seriesalpha,
|
||||||
:linecolor, :linestyle, :linewidth, :linealpha,
|
:linecolor, :linestyle, :linewidth, :linealpha,
|
||||||
:markershape, :markercolor, :markersize, :markeralpha,
|
:markershape, :markercolor, :markersize, :markeralpha,
|
||||||
:markerstrokewidth, :markerstrokecolor, :markerstrokealpha,
|
:markerstrokewidth, :markerstrokecolor, :markerstrokealpha,
|
||||||
@ -78,6 +79,7 @@ supportedArgs(::PyPlotBackend) = [
|
|||||||
:group,
|
:group,
|
||||||
:label,
|
:label,
|
||||||
:linetype,
|
:linetype,
|
||||||
|
:seriescolor, :seriesalpha,
|
||||||
:linecolor, :linestyle, :linewidth, :linealpha,
|
:linecolor, :linestyle, :linewidth, :linealpha,
|
||||||
:markershape, :markercolor, :markersize, :markeralpha,
|
:markershape, :markercolor, :markersize, :markeralpha,
|
||||||
:markerstrokewidth, :markerstrokecolor, :markerstrokealpha,
|
:markerstrokewidth, :markerstrokecolor, :markerstrokealpha,
|
||||||
@ -132,6 +134,7 @@ supportedArgs(::GRBackend) = [
|
|||||||
:layout,
|
:layout,
|
||||||
:legend,
|
:legend,
|
||||||
:colorbar,
|
:colorbar,
|
||||||
|
:seriescolor, :seriesalpha,
|
||||||
:linestyle,
|
:linestyle,
|
||||||
:linetype,
|
:linetype,
|
||||||
:linewidth,
|
:linewidth,
|
||||||
@ -213,6 +216,7 @@ supportedArgs(::QwtBackend) = [
|
|||||||
:label,
|
:label,
|
||||||
:layout,
|
:layout,
|
||||||
:legend,
|
:legend,
|
||||||
|
:seriescolor, :seriesalpha,
|
||||||
:linestyle,
|
:linestyle,
|
||||||
:linetype,
|
:linetype,
|
||||||
:linewidth,
|
:linewidth,
|
||||||
@ -271,6 +275,7 @@ supportedArgs(::UnicodePlotsBackend) = [
|
|||||||
:label,
|
:label,
|
||||||
# :layout,
|
# :layout,
|
||||||
:legend,
|
:legend,
|
||||||
|
:seriescolor, :seriesalpha,
|
||||||
:linestyle,
|
:linestyle,
|
||||||
:linetype,
|
:linetype,
|
||||||
# :linewidth,
|
# :linewidth,
|
||||||
@ -335,6 +340,7 @@ supportedArgs(::WinstonBackend) = [
|
|||||||
:label,
|
:label,
|
||||||
# :layout,
|
# :layout,
|
||||||
:legend,
|
:legend,
|
||||||
|
:seriescolor, :seriesalpha,
|
||||||
:linestyle,
|
:linestyle,
|
||||||
:linetype,
|
:linetype,
|
||||||
:linewidth,
|
:linewidth,
|
||||||
@ -396,6 +402,7 @@ supportedArgs(::BokehBackend) = [
|
|||||||
# :label,
|
# :label,
|
||||||
# :layout,
|
# :layout,
|
||||||
# :legend,
|
# :legend,
|
||||||
|
:seriescolor, :seriesalpha,
|
||||||
:linestyle,
|
:linestyle,
|
||||||
:linetype,
|
:linetype,
|
||||||
:linewidth,
|
:linewidth,
|
||||||
@ -461,6 +468,7 @@ supportedArgs(::PlotlyBackend) = [
|
|||||||
:label,
|
:label,
|
||||||
:layout,
|
:layout,
|
||||||
:legend,
|
:legend,
|
||||||
|
:seriescolor, :seriesalpha,
|
||||||
:linecolor,
|
:linecolor,
|
||||||
:linestyle,
|
:linestyle,
|
||||||
:linetype,
|
:linetype,
|
||||||
@ -537,6 +545,7 @@ supportedArgs(::PlotlyJSBackend) = [
|
|||||||
:label,
|
:label,
|
||||||
:layout,
|
:layout,
|
||||||
:legend,
|
:legend,
|
||||||
|
:seriescolor, :seriesalpha,
|
||||||
:linecolor,
|
:linecolor,
|
||||||
:linestyle,
|
:linestyle,
|
||||||
:linetype,
|
:linetype,
|
||||||
@ -615,6 +624,7 @@ supportedArgs(::GLVisualizeBackend) = [
|
|||||||
# :linecolor,
|
# :linecolor,
|
||||||
# :linestyle,
|
# :linestyle,
|
||||||
:linetype
|
:linetype
|
||||||
|
# :seriescolor, :seriesalpha,
|
||||||
# :linewidth,
|
# :linewidth,
|
||||||
# :linealpha,
|
# :linealpha,
|
||||||
# :markershape,
|
# :markershape,
|
||||||
@ -677,6 +687,7 @@ supportedArgs(::PGFPlotsBackend) = [
|
|||||||
# :label,
|
# :label,
|
||||||
# :layout,
|
# :layout,
|
||||||
# :legend,
|
# :legend,
|
||||||
|
# :seriescolor, :seriesalpha,
|
||||||
# :linecolor,
|
# :linecolor,
|
||||||
# :linestyle,
|
# :linestyle,
|
||||||
# :linetype,
|
# :linetype,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user