Re: Problem of 'rotated' data from mat-file when plotted
Juan Nunez-Iglesias <[email protected]>
| Newsgroups | gmane.comp.python.scientific.user |
|---|---|
| Message-ID | <da8be991-7861-48b3-841e-476a9e7bc79f@Spark> |
Hi Oleg, I haven’t gone carefully over your code but I suspect it has to do with mixing row/column coordinates with x/y (cartesian) coordinates. See this document for a brief explanation in the context of images: http://scikit-image.org/docs/dev/user_guide/numpy_images.html#coordinate-conventions So you probably have to mess with x2 and y2 somewhere to transpose them. Probably in the call to meshgrid, where NumPy would expect row/column and you are providing x/y. Juan. On 23 Mar 2018, 12:26 PM -0400, O.Zolotov <[email protected]>, wrote: > Dear All, > > I try to ‘plot’ data from mat-file. The matlab file’s URL is > https://agupubs.onlinelibrary.wiley.com/action/downloadSupplement?doi=10.1002%2F2016JA023579&attachmentId=2190682395 > > (~80Mb!) > > When I plot the figure, it looks rotated over the original one. Is > there a way to fix this? I tested it using SciLab also, and it > produced the figure as expected, so the problem is unlikely in the > file itself. I use the following commands to plot the figure > > import scipy.io as s > import numpy as np > > ds2 = s.loadmat(r"jgra53413-sup-0003-DataSetS2.mat") > jx2, jy2, jz2 = ds2['jx'], ds2['jy'], ds2['jz'] > x2, y2, z2 = ds2['x'][0], ds2['y'][0], ds2['z'][0] > X2, Y2 = np.meshgrid(x2,y2) > > import matplotlib.pyplot as plt > plt.subplot(2,2,1) > plt.pcolor(X2, Y2, jz2[:,:,0]) > plt.colorbar() > plt.show() > > The original and plotted images are attached. > > Regards, > Oleg > > _______________________________________________ > SciPy-User mailing list > [email protected] > https://mail.python.org/mailman/listinfo/scipy-user _______________________________________________ SciPy-User mailing list [email protected] https://mail.python.org/mailman/listinfo/scipy-user