moved series_annotations into series recipe processing; change pyplot clf to fig clear
This commit is contained in:
parent
e5c4f782a5
commit
ec826fc8ce
@ -343,7 +343,7 @@ function _create_backend_figure(plt::Plot{PyPlotBackend})
|
|||||||
end
|
end
|
||||||
|
|
||||||
# clear the figure
|
# clear the figure
|
||||||
PyPlot.clf()
|
# PyPlot.clf()
|
||||||
fig
|
fig
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1003,12 +1003,10 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||||
# clear the figure
|
# update the fig
|
||||||
PyPlot.clf()
|
|
||||||
|
|
||||||
# update the specs
|
|
||||||
w, h = plt[:size]
|
w, h = plt[:size]
|
||||||
fig = plt.o
|
fig = plt.o
|
||||||
|
fig[:clear]()
|
||||||
fig[:set_size_inches](px2inch(w), px2inch(h), forward = true)
|
fig[:set_size_inches](px2inch(w), px2inch(h), forward = true)
|
||||||
fig[:set_facecolor](py_color(plt[:background_color_outside]))
|
fig[:set_facecolor](py_color(plt[:background_color_outside]))
|
||||||
fig[:set_dpi](DPI)
|
fig[:set_dpi](DPI)
|
||||||
|
|||||||
34
src/plot.jl
34
src/plot.jl
@ -188,6 +188,18 @@ function _apply_series_recipe(plt::Plot, d::KW)
|
|||||||
sp.attr[:init] = true
|
sp.attr[:init] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# strip out series annotations (those which are based on series x/y coords)
|
||||||
|
# and add them to the subplot attr
|
||||||
|
sp_anns = annotations(sp[:annotations])
|
||||||
|
anns = annotations(pop!(d, :series_annotations, []))
|
||||||
|
if length(anns) > 0
|
||||||
|
x, y = d[:x], d[:y]
|
||||||
|
nx, ny, na = map(length, (x,y,anns))
|
||||||
|
n = max(nx, ny, na)
|
||||||
|
anns = [(x[mod1(i,nx)], y[mod1(i,ny)], text(anns[mod1(i,na)])) for i=1:n]
|
||||||
|
end
|
||||||
|
sp.attr[:annotations] = vcat(sp_anns, anns)
|
||||||
|
|
||||||
# adjust extrema and discrete info
|
# adjust extrema and discrete info
|
||||||
if st == :image
|
if st == :image
|
||||||
w, h = size(d[:z])
|
w, h = size(d[:z])
|
||||||
@ -454,17 +466,17 @@ function _plot!(plt::Plot, d::KW, args...)
|
|||||||
sp = kw[:subplot]
|
sp = kw[:subplot]
|
||||||
idx = get_subplot_index(plt, sp)
|
idx = get_subplot_index(plt, sp)
|
||||||
|
|
||||||
# strip out series annotations (those which are based on series x/y coords)
|
# # strip out series annotations (those which are based on series x/y coords)
|
||||||
# and add them to the subplot attr
|
# # and add them to the subplot attr
|
||||||
sp_anns = annotations(sp[:annotations])
|
# sp_anns = annotations(sp[:annotations])
|
||||||
anns = annotations(pop!(kw, :series_annotations, []))
|
# anns = annotations(pop!(kw, :series_annotations, []))
|
||||||
if length(anns) > 0
|
# if length(anns) > 0
|
||||||
x, y = kw[:x], kw[:y]
|
# x, y = kw[:x], kw[:y]
|
||||||
nx, ny, na = map(length, (x,y,anns))
|
# nx, ny, na = map(length, (x,y,anns))
|
||||||
n = max(nx, ny, na)
|
# n = max(nx, ny, na)
|
||||||
anns = [(x[mod1(i,nx)], y[mod1(i,ny)], text(anns[mod1(i,na)])) for i=1:n]
|
# anns = [(x[mod1(i,nx)], y[mod1(i,ny)], text(anns[mod1(i,na)])) for i=1:n]
|
||||||
end
|
# end
|
||||||
sp.attr[:annotations] = vcat(sp_anns, anns)
|
# sp.attr[:annotations] = vcat(sp_anns, anns)
|
||||||
|
|
||||||
# we update subplot args in case something like the color palatte is part of the recipe
|
# we update subplot args in case something like the color palatte is part of the recipe
|
||||||
_update_subplot_args(plt, sp, kw, idx)
|
_update_subplot_args(plt, sp, kw, idx)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user