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

error when passing string marker argument to plot #468

Closed
CarloLucibello opened this issue Mar 7, 2020 · 1 comment
Closed

error when passing string marker argument to plot #468

CarloLucibello opened this issue Mar 7, 2020 · 1 comment

Comments

@CarloLucibello
Copy link

this is what I get

julia> plt.plot(rand(10), marker='o')
PyError ($(Expr(:escape, :(ccall(#= /home/carlo/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'TypeError'>
TypeError("float() argument must be a string or a number, not 'PyCall.jlwrap'")
  File "/usr/lib/python3.8/site-packages/matplotlib/pyplot.py", line 2794, in plot
    return gca().plot(
  File "/usr/lib/python3.8/site-packages/matplotlib/axes/_axes.py", line 1665, in plot
    lines = [*self._get_lines(*args, data=data, **kwargs)]
  File "/usr/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 225, in __call__
    yield from self._plot_args(this, kwargs)
  File "/usr/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 405, in _plot_args
    seg = func(x[:, j % ncx], y[:, j % ncy], kw, kwargs)
  File "/usr/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 312, in _makeline
    seg = mlines.Line2D(x, y, **kw)
  File "/usr/lib/python3.8/site-packages/matplotlib/lines.py", line 382, in __init__
    self._marker = MarkerStyle(marker, fillstyle)
  File "/usr/lib/python3.8/site-packages/matplotlib/markers.py", line 243, in __init__
    self.set_marker(marker)
  File "/usr/lib/python3.8/site-packages/matplotlib/markers.py", line 309, in set_marker
    Path(marker)
  File "/usr/lib/python3.8/site-packages/matplotlib/path.py", line 127, in __init__
    vertices = _to_unmasked_float_array(vertices)
  File "/usr/lib/python3.8/site-packages/matplotlib/cbook/__init__.py", line 1390, in _to_unmasked_float_array
    return np.asarray(x, float)
  File "/usr/lib/python3.8/site-packages/numpy/core/_asarray.py", line 85, in asarray
    return array(a, dtype, copy=False, order=order)


Stacktrace:
 [1] pyerr_check at /home/carlo/.julia/packages/PyCall/zqDXB/src/exception.jl:60 [inlined]
 [2] pyerr_check at /home/carlo/.julia/packages/PyCall/zqDXB/src/exception.jl:64 [inlined]
 [3] _handle_error(::String) at /home/carlo/.julia/packages/PyCall/zqDXB/src/exception.jl:81
 [4] macro expansion at /home/carlo/.julia/packages/PyCall/zqDXB/src/exception.jl:95 [inlined]
 [5] #110 at /home/carlo/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:43 [inlined]
 [6] disable_sigint at ./c.jl:446 [inlined]
 [7] __pycall! at /home/carlo/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:42 [inlined]
 [8] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{Array{Int64,1}}, ::Int64, ::PyCall.PyObject) at /home/carlo/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:29
 [9] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{Array{Int64,1}}, ::Base.Iterators.Pairs{Symbol,Char,Tuple{Symbol},NamedTuple{(:marker,),Tuple{Char}}}) at /home/carlo/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:11
 [10] #pycall#116 at /home/carlo/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:83 [inlined]
 [11] #pycall at ./none:0 [inlined]
 [12] #plot#85(::Base.Iterators.Pairs{Symbol,Char,Tuple{Symbol},NamedTuple{(:marker,),Tuple{Char}}}, ::typeof(plot), ::Array{Int64,1}) at /home/carlo/.julia/packages/PyPlot/4wzW1/src/PyPlot.jl:177
 [13] (::PyPlot.var"#kw##plot")(::NamedTuple{(:marker,),Tuple{Char}}, ::typeof(plot), ::Array{Int64,1}) at ./none:0
 [14] top-level scope at In[28]:1
@CarloLucibello
Copy link
Author

ops, I was actually passing a Char instead of a String, plt.plot(rand(10), marker="o") works fine

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