use existing colorbar axis if it already exists (for PyPlot)
This commit is contained in:
parent
6a129bfe92
commit
1717777e8b
@ -1000,7 +1000,14 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
|||||||
# create and store the colorbar object (handle) and the axis that it is drawn on.
|
# create and store the colorbar object (handle) and the axis that it is drawn on.
|
||||||
# note: the colorbar axis is positioned independently from the subplot axis
|
# note: the colorbar axis is positioned independently from the subplot axis
|
||||||
fig = plt.o
|
fig = plt.o
|
||||||
|
|
||||||
|
if haskey(fig, :cbar_ax)
|
||||||
|
cbax = fig[:cbar_ax]
|
||||||
|
cbar[:clear]()
|
||||||
|
else
|
||||||
cbax = fig[:add_axes]([0.8,0.1,0.03,0.8], label = string(gensym()))
|
cbax = fig[:add_axes]([0.8,0.1,0.03,0.8], label = string(gensym()))
|
||||||
|
end
|
||||||
|
|
||||||
cb = fig[:colorbar](handle; cax = cbax, kw...)
|
cb = fig[:colorbar](handle; cax = cbax, kw...)
|
||||||
cb[:set_label](sp[:colorbar_title])
|
cb[:set_label](sp[:colorbar_title])
|
||||||
sp.attr[:cbar_handle] = cb
|
sp.attr[:cbar_handle] = cb
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user