contour3d

This commit is contained in:
Thomas Breloff 2016-04-26 14:35:51 -04:00
parent b9d20142a2
commit 8b569e3cd8
4 changed files with 27 additions and 13 deletions

View File

@ -60,6 +60,8 @@ export
pie!,
contour,
contour!,
contour3d,
contour3d!,
surface,
surface!,
wireframe,
@ -191,6 +193,8 @@ pie(args...; kw...) = plot(args...; kw..., linetype = :pie)
pie!(args...; kw...) = plot!(args...; kw..., linetype = :pie)
contour(args...; kw...) = plot(args...; kw..., linetype = :contour)
contour!(args...; kw...) = plot!(args...; kw..., linetype = :contour)
contour3d(args...; kw...) = plot(args...; kw..., linetype = :contour3d)
contour3d!(args...; kw...) = plot!(args...; kw..., linetype = :contour3d)
surface(args...; kw...) = plot(args...; kw..., linetype = :surface)
surface!(args...; kw...) = plot!(args...; kw..., linetype = :surface)
wireframe(args...; kw...) = plot(args...; kw..., linetype = :wireframe)

View File

@ -7,11 +7,11 @@ const _allAxes = [:auto, :left, :right]
:r => :right
)
const _3dTypes = [:path3d, :scatter3d, :surface, :wireframe]
const _3dTypes = [:path3d, :scatter3d, :surface, :wireframe, :contour3d]
const _allTypes = vcat([
:none, :line, :path, :steppre, :steppost, :sticks, :scatter,
:heatmap, :hexbin, :hist, :hist2d, :hist3d, :density, :bar, :hline, :vline, :ohlc,
:contour, :pie, :shape, :box, :violin, :quiver
:contour, :contour3d, :pie, :shape, :box, :violin, :quiver
], _3dTypes)
@compat const _typeAliases = KW(
:n => :none,
@ -45,7 +45,7 @@ const _allTypes = vcat([
like_histogram(linetype::Symbol) = linetype in (:hist, :density)
like_line(linetype::Symbol) = linetype in (:line, :path, :steppre, :steppost)
like_surface(linetype::Symbol) = linetype in (:contour, :heatmap, :surface, :wireframe)
like_surface(linetype::Symbol) = linetype in (:contour, :contour3d, :heatmap, :surface, :wireframe)
const _allStyles = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]

View File

@ -455,7 +455,7 @@ function _add_series(pkg::PyPlotBackend, plt::Plot, d::KW)
end
end
if lt == :contour
if lt in (:contour, :contour3d)
z = z.surf'
needs_colorbar = true
@ -470,6 +470,10 @@ function _add_series(pkg::PyPlotBackend, plt::Plot, d::KW)
error("Only numbers and vectors are supported with levels keyword")
end
if lt == :contour3d
extrakw[:extend3d] = true
end
# contour lines
handle = ax[:contour](x, y, z, args...;
label = d[:label],
@ -482,13 +486,15 @@ function _add_series(pkg::PyPlotBackend, plt::Plot, d::KW)
push!(handles, handle)
# contour fills
handle = ax[:contourf](x, y, z, args...;
label = d[:label],
zorder = plt.n + 0.5,
cmap = pyfillcolormap(d),
extrakw...
)
push!(handles, handle)
if lt == :contour
handle = ax[:contourf](x, y, z, args...;
label = d[:label],
zorder = plt.n + 0.5,
cmap = pyfillcolormap(d),
extrakw...
)
push!(handles, handle)
end
end
if lt in (:surface, :wireframe)
@ -914,7 +920,11 @@ function addPyPlotLegend(plt::Plot, ax)
leg = plt.plotargs[:legend]
if leg != :none
# gotta do this to ensure both axes are included
args = filter(x -> !(x[:linetype] in (:hist,:density,:hexbin,:hist2d,:hline,:vline,:contour,:surface,:wireframe,:heatmap,:path3d,:scatter3d)), plt.seriesargs)
args = filter(x -> !(x[:linetype] in (
:hist,:density,:hexbin,:hist2d,:hline,:vline,
:contour,:contour3d,:surface,:wireframe,
:heatmap,:path3d,:scatter3d
)), plt.seriesargs)
args = filter(x -> x[:label] != "", args)
if length(args) > 0
leg = ax[:legend]([d[:serieshandle][1] for d in args],

View File

@ -112,7 +112,7 @@ supportedTypes(::PyPlotBackend) = [
:scatter, :hist2d, :hexbin, :hist, :density,
:bar, :sticks, :box, :violin, :quiver,
:hline, :vline, :heatmap,
:contour, :path3d, :scatter3d, :surface, :wireframe
:contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe
]
supportedStyles(::PyPlotBackend) = [:auto, :solid, :dash, :dot, :dashdot]
supportedMarkers(::PyPlotBackend) = vcat(_allMarkers, Shape)