0

I have three 1D NumPy Arrays XX, YY, and ZZ. They are organized such that ZZ[i] is the height of a hill at coordinates XX[i], YY[i]. How can I plot this using Python?

Edit: The arrays are quite large (each contain about 3e5 data points)

Edit 2: I want a surface plot

Thanks

5
  • What sort of plot do you want? A scatter plot, a surface plot, a contour plot...? Commented Feb 13, 2024 at 12:56
  • Can you please post what you have tried so far? Are you getting errors? Did you try anything before you posted the question? Commented Feb 13, 2024 at 13:36
  • You can use matplotlib for surface plots. But you first need to re-organise your arrays on a regular grid. You can use this Commented Feb 13, 2024 at 14:14
  • 1
    If the input is organised as a regular grid, ax.plot_surface with reshaped x, y and z is recommended. If the input x and y are irregular spaced, [ax.trisurf3d](ax.matplotlib.org/stable/gallery/mplot3d/trisurf3d.html) will work. Commented Feb 13, 2024 at 14:54
  • @JohanC, thanks, ax.trisurf3d fixed it. Commented Feb 13, 2024 at 15:07

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.