From a6588daa3e92312261129f2bbe85ebb9b858306d Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Fri, 26 Apr 2019 13:17:29 +0200 Subject: [PATCH] allow negative radii in polar plots for pyplot --- src/backends/pyplot.jl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index d3e0e091..3618412f 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -376,6 +376,18 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series) elseif st == :shape x, y = shape_data(series) end + + if ispolar(series) + # make negative radii positive and flip the angle + # (PyPlot ignores negative radii) + for i in eachindex(y) + if y[i] < 0 + y[i] = -y[i] + x[i] -= π + end + end + end + xyargs = (st in _3dTypes ? (x,y,z) : (x,y)) # handle zcolor and get c/cmap