openPMD-viewer
openPMD-viewer copied to clipboard
How to rotate the axes
When I set slice_across='y' and plot=True in ts.get_field, what I draw is a picture of the x-z plane, but I want to rotate the coordinate axis to draw a picture of the z-x plane, what should I do?
Instead of plot=True you can take the numpy 2D array that the ts.get_field returns, transpose it as usual with .T and then plug it into matplotlib's plt.imshow().
Data API:
- https://github.com/openPMD/openPMD-viewer/blob/dev/tutorials/1_Introduction-to-the-API.ipynb
Numpy:
- https://numpy.org/doc/stable/reference/generated/numpy.ndarray.T.html
Matplotlib:
- https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.imshow.html
- https://matplotlib.org/stable/gallery/images_contours_and_fields/image_demo.html
Thank you very much, this problem has been solved. Another question is how to select a specific id format in select like select=[id]? And how to write or such as x=[None,-8e-6]or[8e-6,None], thank you!