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

set_yticks( [ ] ); Failed to convert value(s) to axis units #36

Closed
mdhe1248 opened this issue Mar 25, 2024 · 2 comments
Closed

set_yticks( [ ] ); Failed to convert value(s) to axis units #36

mdhe1248 opened this issue Mar 25, 2024 · 2 comments

Comments

@mdhe1248
Copy link

How can I remove all ticks? The help doc says,
Pass an empty list to remove all ticks::
set_yticks([])

This used to work with PyPlot.jl (although I have not tried it after some system update), but with PythonPlot, i am getting the following error:
ERROR: Python: ConversionError: Failed to convert value(s) to axis units: Julia: Any[]

Thank you in advance!

@stevengj
Copy link
Member

Apparently Matplotlib doesn't like PythonCall's wrapper for a Julia empty Any array. Either of the following seem to work:

ax.set_yticks(Int[]) # use a typed empty array — numpy knows how to convert this
ax.set_yticks(pylist()) # use a native Python empty list

@stevengj
Copy link
Member

See JuliaPy/PythonCall.jl#486 — PythonCall converts [] == Any[] into something like a numpy array of object, which is treated quite differently in numpy than a Python list.

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

2 participants