pyplot colorbar fix; annotation fix; new contour example; travis fix
This commit is contained in:
parent
29d93ba33e
commit
3cf428d7ea
11
src/args.jl
11
src/args.jl
@ -911,14 +911,19 @@ end
|
||||
|
||||
|
||||
# update a subplots args and axes
|
||||
function _update_subplot_args(plt::Plot, sp::Subplot, d_in::KW, subplot_index::Integer)
|
||||
function _update_subplot_args(plt::Plot, sp::Subplot, d_in::KW, subplot_index::Integer; remove_pair = true)
|
||||
pargs = plt.attr
|
||||
spargs = sp.attr
|
||||
# @show subplot_index, sp
|
||||
anns = pop!(sp.attr, :annotations, [])
|
||||
|
||||
# grab those args which apply to this subplot
|
||||
for (k,v) in _subplot_defaults
|
||||
slice_arg!(d_in, spargs, k, v, subplot_index)
|
||||
slice_arg!(d_in, spargs, k, v, subplot_index, remove_pair = remove_pair)
|
||||
end
|
||||
|
||||
# extend annotations
|
||||
sp.attr[:annotations] = vcat(anns, sp[:annotations])
|
||||
|
||||
# handle legend/colorbar
|
||||
spargs[:legend] = convertLegendValue(spargs[:legend])
|
||||
spargs[:colorbar] = convertLegendValue(spargs[:colorbar])
|
||||
|
||||
@ -815,7 +815,7 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
||||
# 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
|
||||
fig = plt.o
|
||||
cbax = fig[:add_axes]([0.8,0.1,0.03,0.8])
|
||||
cbax = fig[:add_axes]([0.8,0.1,0.03,0.8], label = string(gensym()))
|
||||
sp.attr[:cbar_handle] = fig[:colorbar](handle; cax = cbax, kw...)
|
||||
sp.attr[:cbar_ax] = cbax
|
||||
end
|
||||
|
||||
@ -179,6 +179,7 @@ PlotExample("Adding to subplots",
|
||||
PlotExample("",
|
||||
"",
|
||||
[:(begin
|
||||
srand(111)
|
||||
plot!(Plots.fakedata(100,10))
|
||||
end)]
|
||||
),
|
||||
@ -220,13 +221,24 @@ PlotExample("Custom Markers",
|
||||
),
|
||||
|
||||
PlotExample("Contours",
|
||||
"",
|
||||
"Any value for fill works here. We first build a filled contour from a function, then an unfilled contour from a matrix.",
|
||||
[:(begin
|
||||
x = 1:0.3:20
|
||||
y = x
|
||||
f(x,y) = sin(x)+cos(y)
|
||||
contour(x, y, f, fill=true)
|
||||
x = 1:0.5:20
|
||||
y = 1:0.5:10
|
||||
f(x,y) = (3x+y^2)*abs(sin(x)+cos(y))
|
||||
X = repmat(x', length(y), 1)
|
||||
Y = repmat(y, 1, length(x))
|
||||
Z = map(f, X, Y)
|
||||
p1 = contour(x, y, f, fill=true)
|
||||
p2 = contour(x, y, Z)
|
||||
plot(p1, p2)
|
||||
end)]
|
||||
# [:(begin
|
||||
# x = 1:0.3:20
|
||||
# y = x
|
||||
# f(x,y) = sin(x)+cos(y)
|
||||
# contour(x, y, f, fill=true)
|
||||
# end)]
|
||||
),
|
||||
|
||||
PlotExample("Pie",
|
||||
|
||||
15
src/plot.jl
15
src/plot.jl
@ -283,9 +283,14 @@ function _plot!(plt::Plot, d::KW, args...)
|
||||
# merge in anything meant for plot/subplot
|
||||
for kw in kw_list
|
||||
for (k,v) in kw
|
||||
if haskey(_plot_defaults, k) || haskey(_subplot_defaults, k)
|
||||
d[k] = v
|
||||
for defdict in (_plot_defaults, _subplot_defaults)
|
||||
if haskey(defdict, k)
|
||||
d[k] = pop!(kw, k)
|
||||
end
|
||||
end
|
||||
# if haskey(_plot_defaults, k) || haskey(_subplot_defaults, k)
|
||||
# d[k] = v
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
@ -309,11 +314,11 @@ function _plot!(plt::Plot, d::KW, args...)
|
||||
|
||||
# first apply any args for the subplots
|
||||
for (idx,sp) in enumerate(plt.subplots)
|
||||
_update_subplot_args(plt, sp, d, idx)
|
||||
_update_subplot_args(plt, sp, d, idx, remove_pair = false)
|
||||
end
|
||||
|
||||
# do we need to link any axes together?
|
||||
link_axes!(plt.layout, plt.attr[:link])
|
||||
link_axes!(plt.layout, plt[:link])
|
||||
|
||||
# !!! 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 !!!
|
||||
@ -337,7 +342,7 @@ function _plot!(plt::Plot, d::KW, args...)
|
||||
|
||||
# strip out series annotations (those which are based on series x/y coords)
|
||||
# and add them to the subplot attr
|
||||
sp_anns = annotations(sp.attr[:annotations])
|
||||
sp_anns = annotations(sp[:annotations])
|
||||
anns = annotations(pop!(kw, :series_annotations, []))
|
||||
if length(anns) > 0
|
||||
x, y = kw[:x], kw[:y]
|
||||
|
||||
@ -18,7 +18,7 @@ Pkg.clone("https://github.com/JuliaPlots/PlotReferenceImages.jl.git")
|
||||
# Pkg.clone("https://github.com/spencerlyon2/PlotlyJS.jl.git")
|
||||
|
||||
Pkg.checkout("RecipesBase")
|
||||
Pkg.checkout("VisualRegressionTests")
|
||||
Pkg.clone("VisualRegressionTests")
|
||||
|
||||
ENV["PYTHON"] = ""
|
||||
Pkg.add("PyPlot")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user