-
Notifications
You must be signed in to change notification settings - Fork 87
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
2d array vs 1d array inconsistency with optional argument to Plot3D #58
Comments
Ideally, these bugs would be fixed upstream.... currently, Matplotlib is very inconsistent about accepting row vs. column vectors (some functions allow it, some don't), and I didn't implement any workarounds for keyword arguments yet, though. It should be straightforward. |
These singleton arrays seem to be quite the nuisance, I do hope the julia dev team are going to do away with the ambiguity |
@olaslett, I don't think that's going to happen. Unlike Matlab, Julia has 1d arrays (all arrays in Matlab are at least 2d). Unless Julia defines a separate |
The problem is based on the way that julia distinguishes between singleton arrays and nx1 two-dimensional arrays. The optional argument
zs
forplot3D( xs, ys, zs=zs )
is not robust to these two different representations but the first two argumentsxs, ys
are.Say a matrix of data is generated and three sets of points for plotting are extracted from the columns of the matrix:
Each vector
x, y, z
is a3-element Array{Int64,1}
. These can be plotted using:However, say the matrix is transposed and the rows are spliced and transposed:
Each vector is now a
3x1 Array{Int64,2}
and plotting as above gives:Clearly Plot3D cannot handle this difference well. However, it turns out that the required arguments
xs, ys
are robust to this whereaszs
is not. Using the3x1 Array{Int64,2}
vectors again:Works fine.
Sorry for the very contrived example but this caused me some confusion earlier!
Thanks
The text was updated successfully, but these errors were encountered: