JuliaPy / PyPlot.jl

Plotting for Julia based on matplotlib.pyplot
https://github.com/JuliaPy/PyPlot.jl
MIT License
478 stars 88 forks source link

h = surf(z') #362

Closed PaulSoderlind closed 5 years ago

PaulSoderlind commented 6 years ago

creates an error message on 0.7.0-beta.256 and PyPlot v2.6.0. Example:

using PyPlot
z = rand(30,40)
figure()
  h = surf(z')

However,

figure()
  h = surf(permutedims(z))

works. Intended?

stevengj commented 6 years ago

This is happening because z' in 0.7 produces an Adjoint array type, and PyCall doesn't know how to convert those to a NumPy array so it uses a list of lists, which isn't supported by mplot3d. Probably I should change the fallback in PyCall, and/or do an explicit conversion to Array in PyPlot.surf

PaulSoderlind commented 6 years ago

Thanks for the information. I guess this carries over to plot() and all other functions. In case you decide not to change PyCall/PyPlot, I would suggest adding a line in the README that plot(copy(z')) and surf(copy(z')) work.

PaulSoderlind commented 6 years ago

one more piece of (somewhat related) information: this works on 0.7 but not on 1.0 (since repmat is deprecated)

x = 1:10
y = 1:15
figure()
  surf(x,y,copy(rand(10,15)'))

The issue: x and y are not matrices

stevengj commented 5 years ago

Closed by https://github.com/JuliaPy/PyCall.jl/pull/653