pyplot support for pie charts

This commit is contained in:
Thomas Breloff 2016-04-26 16:01:50 -04:00
parent 5dfd3d2f5d
commit 982a512ebd
5 changed files with 15 additions and 6 deletions

View File

@ -189,8 +189,8 @@ vline(args...; kw...) = plot(args...; kw..., linetype = :vline)
vline!(args...; kw...) = plot!(args...; kw..., linetype = :vline)
ohlc(args...; kw...) = plot(args...; kw..., linetype = :ohlc)
ohlc!(args...; kw...) = plot!(args...; kw..., linetype = :ohlc)
pie(args...; kw...) = plot(args...; kw..., linetype = :pie)
pie!(args...; kw...) = plot!(args...; kw..., linetype = :pie)
pie(args...; kw...) = plot(args...; kw..., linetype = :pie, aspect_ratio = :equal, grid=false, xticks=nothing, yticks=nothing)
pie!(args...; kw...) = plot!(args...; kw..., linetype = :pie, aspect_ratio = :equal, grid=false, xticks=nothing, yticks=nothing)
contour(args...; kw...) = plot(args...; kw..., linetype = :contour)
contour!(args...; kw...) = plot!(args...; kw..., linetype = :contour)
contour3d(args...; kw...) = plot(args...; kw..., linetype = :contour3d)

View File

@ -581,6 +581,15 @@ function _add_series(pkg::PyPlotBackend, plt::Plot, d::KW)
push!(handles, handle)
end
if lt == :pie
handle = ax[:pie](y;
# label = d[:label],
# colors = # a vector of colors?
labels = x
)
push!(handles, handle)
end
d[:serieshandle] = handles
# smoothing
@ -944,7 +953,7 @@ function addPyPlotLegend(plt::Plot, ax)
args = filter(x -> !(x[:linetype] in (
:hist,:density,:hexbin,:hist2d,:hline,:vline,
:contour,:contour3d,:surface,:wireframe,
:heatmap,:path3d,:scatter3d
:heatmap,:path3d,:scatter3d, :pie
)), plt.seriesargs)
args = filter(x -> x[:label] != "", args)
if length(args) > 0

View File

@ -111,7 +111,7 @@ supportedTypes(::PyPlotBackend) = [
:none, :line, :path, :steppre, :steppost, :shape,
:scatter, :hist2d, :hexbin, :hist, :density,
:bar, :sticks, :box, :violin, :quiver,
:hline, :vline, :heatmap,
:hline, :vline, :heatmap, :pie,
:contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe
]
supportedStyles(::PyPlotBackend) = [:auto, :solid, :dash, :dot, :dashdot]

View File

@ -167,7 +167,7 @@ function _add_series(plt::Plot, d::KW, ::Void, args...;
for (i,di) in enumerate(seriesArgList)
plt.n += 1
if !stringsSupported()
if !stringsSupported() && di[:linetype] != :pie
setTicksFromStringVector(d, di, :x, :xticks)
setTicksFromStringVector(d, di, :y, :yticks)
setTicksFromStringVector(d, di, :z, :zticks)

View File

@ -7,7 +7,7 @@
typealias FuncOrFuncs @compat(Union{Function, AVec{Function}})
all3D(d::KW) = trueOrAllTrue(lt -> lt in (:contour, :heatmap, :surface, :wireframe), get(d, :linetype, :none))
all3D(d::KW) = trueOrAllTrue(lt -> lt in (:contour, :heatmap, :surface, :wireframe, :contour3d), get(d, :linetype, :none))
# missing
convertToAnyVector(v::@compat(Void), d::KW) = Any[nothing], nothing