Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proj=:polar fails #540

Open
bc0n opened this issue Nov 5, 2021 · 0 comments
Open

proj=:polar fails #540

bc0n opened this issue Nov 5, 2021 · 0 comments

Comments

@bc0n
Copy link

bc0n commented Nov 5, 2021

Julia 1.6.0
[d330b81b] PyPlot v2.10.0

Following https://docs.juliaplots.org/latest/generated/pyplot/#pyplot-ref27 ,

Θ = range(0, stop = 1.5π, length = 100)
r = abs.(0.1 * randn(100) + sin.(3Θ))
plot(Θ, r, proj = :polar, m = 2)

fails with "Unknown property proj", as below. PyCall is a workaround:

using PyCall
plt = pyimport("matplotlib.pyplot")
plt.axes(polar=true)
th = range(0, stop = 1.5π, length = 100)
r = abs.(0.1 * randn(100) + sin.(3*th))
plt.plot(th, r)
plt.show()
plot(Θ, r, proj = :polar, m = 2)
ERROR: PyError ($(Expr(:escape, :(ccall(#= /home/ben/.julia/packages/PyCall/3fwVL/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'AttributeError'>
AttributeError('Unknown property proj',)
  File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 3261, in plot
    ret = ax.plot(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/__init__.py", line 1718, in inner
    return func(ax, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/axes/_axes.py", line 1372, in plot
    for line in self._get_lines(*args, **kwargs):
  File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 404, in _grab_next_args
    for seg in self._plot_args(this, kwargs):
  File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 394, in _plot_args
    seg = func(x[:, j % ncx], y[:, j % ncy], kw, kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 301, in _makeline
    seg = mlines.Line2D(x, y, **kw)
  File "/usr/lib/python3/dist-packages/matplotlib/lines.py", line 426, in __init__
    self.update(kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 902, in update
    for k, v in props.items()]
  File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 902, in <listcomp>
    for k, v in props.items()]
  File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 895, in _update_property
    raise AttributeError('Unknown property %s' % k)

Stacktrace:
  [1] pyerr_check
    @ ~/.julia/packages/PyCall/3fwVL/src/exception.jl:62 [inlined]
  [2] pyerr_check
    @ ~/.julia/packages/PyCall/3fwVL/src/exception.jl:66 [inlined]
  [3] _handle_error(msg::String)
    @ PyCall ~/.julia/packages/PyCall/3fwVL/src/exception.jl:83
  [4] macro expansion
    @ ~/.julia/packages/PyCall/3fwVL/src/exception.jl:97 [inlined]
  [5] #107
    @ ~/.julia/packages/PyCall/3fwVL/src/pyfncall.jl:43 [inlined]
  [6] disable_sigint
    @ ./c.jl:458 [inlined]
  [7] __pycall!
    @ ~/.julia/packages/PyCall/3fwVL/src/pyfncall.jl:42 [inlined]
  [8] _pycall!(ret::PyCall.PyObject, o::PyCall.PyObject, args::Tuple{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, Vector{Float64}}, nargs::Int64, kw::PyCall.PyObject)
    @ PyCall ~/.julia/packages/PyCall/3fwVL/src/pyfncall.jl:29
  [9] _pycall!(ret::PyCall.PyObject, o::PyCall.PyObject, args::Tuple{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, Vector{Float64}}, kwargs::Base.Iterators.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:proj, :m), Tuple{Symbol, Int64}}})
    @ PyCall ~/.julia/packages/PyCall/3fwVL/src/pyfncall.jl:11
 [10] pycall(::PyCall.PyObject, ::Type{PyCall.PyAny}, ::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, ::Vararg{Any, N} where N; kwargs::Base.Iterators.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:proj, :m), Tuple{Symbol, Int64}}})
    @ PyCall ~/.julia/packages/PyCall/3fwVL/src/pyfncall.jl:83
 [11] plot(::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, ::Vararg{Any, N} where N; kws::Base.Iterators.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:proj, :m), Tuple{Symbol, Int64}}})
    @ PyPlot ~/.julia/packages/PyPlot/XaELc/src/PyPlot.jl:177
 [12] top-level scope
    @ REPL[5]:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant