fixes for contours in pyplot and gadfly
This commit is contained in:
parent
fc6f0f3a86
commit
6beadcece8
@ -119,8 +119,9 @@ function addGadflyLine!(plt::Plot, numlayers::Int, d::Dict, geoms...)
|
|||||||
kwargs[:xmin] = d[:x] - w
|
kwargs[:xmin] = d[:x] - w
|
||||||
kwargs[:xmax] = d[:x] + w
|
kwargs[:xmax] = d[:x] + w
|
||||||
elseif lt == :contour
|
elseif lt == :contour
|
||||||
d[:y] = reverse(d[:y])
|
# d[:y] = reverse(d[:y])
|
||||||
kwargs[:z] = d[:surface]
|
kwargs[:z] = d[:surface]
|
||||||
|
addGadflyContColorScale(plt, d[:linecolor])
|
||||||
end
|
end
|
||||||
|
|
||||||
kwargs[:x] = d[lt == :hist ? :y : :x]
|
kwargs[:x] = d[lt == :hist ? :y : :x]
|
||||||
@ -190,6 +191,13 @@ function getGadflyMarkerTheme(d::Dict, plotargs::Dict)
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function addGadflyContColorScale(plt::Plot{GadflyPackage}, c)
|
||||||
|
if !isa(c, ColorGradient)
|
||||||
|
c = colorscheme(:bluesreds)
|
||||||
|
end
|
||||||
|
push!(getGadflyContext(plt).scales, Gadfly.Scale.ContinuousColorScale(p -> RGB(getColorZ(c, p))))
|
||||||
|
end
|
||||||
|
|
||||||
function addGadflyMarker!(plt::Plot, numlayers::Int, d::Dict, plotargs::Dict, geoms...)
|
function addGadflyMarker!(plt::Plot, numlayers::Int, d::Dict, plotargs::Dict, geoms...)
|
||||||
gfargs = vcat(geoms...,
|
gfargs = vcat(geoms...,
|
||||||
getGadflyMarkerTheme(d, plotargs),
|
getGadflyMarkerTheme(d, plotargs),
|
||||||
@ -200,10 +208,11 @@ function addGadflyMarker!(plt::Plot, numlayers::Int, d::Dict, plotargs::Dict, ge
|
|||||||
zcolor = d[:zcolor]
|
zcolor = d[:zcolor]
|
||||||
if zcolor != nothing && typeof(zcolor) <: AVec
|
if zcolor != nothing && typeof(zcolor) <: AVec
|
||||||
kwargs[:color] = zcolor
|
kwargs[:color] = zcolor
|
||||||
if !isa(d[:markercolor], ColorGradient)
|
addGadflyContColorScale(plt, d[:markercolor])
|
||||||
d[:markercolor] = colorscheme(:bluesreds)
|
# if !isa(d[:markercolor], ColorGradient)
|
||||||
end
|
# d[:markercolor] = colorscheme(:bluesreds)
|
||||||
push!(getGadflyContext(plt).scales, Gadfly.Scale.ContinuousColorScale(p -> RGB(getColorZ(d[:markercolor], p))))
|
# end
|
||||||
|
# push!(getGadflyContext(plt).scales, Gadfly.Scale.ContinuousColorScale(p -> RGB(getColorZ(d[:markercolor], p))))
|
||||||
end
|
end
|
||||||
|
|
||||||
Gadfly.layer(gfargs...; x = d[:x], y = d[:y], order=numlayers, kwargs...)
|
Gadfly.layer(gfargs...; x = d[:x], y = d[:y], order=numlayers, kwargs...)
|
||||||
|
|||||||
@ -319,7 +319,7 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...)
|
|||||||
elseif lt == :contour
|
elseif lt == :contour
|
||||||
# NOTE: x/y are backwards in pyplot, so we switch the x and y args (also y is reversed),
|
# NOTE: x/y are backwards in pyplot, so we switch the x and y args (also y is reversed),
|
||||||
# and take the transpose of the surface matrix
|
# and take the transpose of the surface matrix
|
||||||
x, y = d[:y], d[:x]
|
x, y = d[:x], d[:y]
|
||||||
surf = d[:surface]'
|
surf = d[:surface]'
|
||||||
handle = plotfunc(x, y, surf, d[:nlevels]; extra_kwargs...)
|
handle = plotfunc(x, y, surf, d[:nlevels]; extra_kwargs...)
|
||||||
if d[:fillrange] != nothing
|
if d[:fillrange] != nothing
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user