Open ghost opened 10 years ago
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 PyPlot
has to work around this.
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 Array
type for row vectors, those will need to be 2d arrays.
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