Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8778695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:35:39+00:00 2026-06-13T19:35:39+00:00

So I have a 2D array (named Data) that looks like: Shape 0 Shape

  • 0

So I have a 2D array (named Data) that looks like:

            Shape 0       Shape 1     ...      Shape N
            -------       -------              -------

Scale 0  |  Value00   ,   Value01     ...      Value0N |

Scale 1  |  Value10   ,   Value11     ...      Value1N |

  .
  .
  .

Scale N  |  ValueN0   ,   ValueN1     ...      ValueNN |

And I want to create a 3D plot where the ValueXXs are the Z axis. I’ve tried two attempts, but each give me a surface that is rotated with respect to the other one, so I’ve gotten myself a bit confused. Here is my 1st attempt at a solution:

x,y = numpy.mgrid[0:50:50j,0:50:50j]
f = Data
fig = plt.figure()
ax = Axes3D(fig)
ax.plot_surface(x,y,f,rstride=1,cstride=1)

Here is my second attempt:

nx, ny = 50, 50
x = range(nx)
y = range(ny)
hf = plt.figure()
ha = hf.add_subplot(111, projection='3d')
X, Y = numpy.meshgrid(x, y)  
ha.plot_surface(X,Y,Data,rstride=1,cstride=1)

Examining X and Y does no help really because its a square. I’m not sure when X represents my ‘Scale’ vs when it is representing my ‘Shape’.

So, what is really going on with these two examples? Is there a better way to plot this array?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:35:40+00:00Added an answer on June 13, 2026 at 7:35 pm

    If I understand you right, the confusion is which axis is which, right? If this is the case, you can easily plot a known asymmetric shape and the plot will tell you everything. For example, adopting an example from the gallery:

    # By Armin Moser
    
    from mpl_toolkits.mplot3d import Axes3D
    import matplotlib
    import numpy as np
    from matplotlib import cm
    from matplotlib import pyplot as plt
    step = 0.04
    maxval = 1.0
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    
    # create supporting points in polar coordinates
    r = np.linspace(0,1.25,50)
    p = np.linspace(0,2*np.pi,50)
    R,P = np.meshgrid(r,p)
    # transform them to cartesian system
    X,Y = R*np.cos(P),R*np.sin(P)
    
    #Z = ((R**2 - 1)**2)
    Z = (X**2 + 0.2*Y**2 -1)**2   # <------- edit
    
    ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
    #ax.set_zlim3d(0, 1)
    ax.set_xlabel(r'$\phi_\mathrm{real}$')
    ax.set_ylabel(r'$\phi_\mathrm{im}$')
    ax.set_zlabel(r'$V(\phi)$')
    plt.show()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multidimensional array that looks something like this: ourThing = array( 'id'
I have an array of folders/files that looks like this: Array ( [Root Folder
I have a data.frame that looks like a = c(sample1, asd) b = c(sample2
I have a Json array that looks like this: Test = [ { adj
i have an array that looks like this: foreach($obj as $key => $value) {
I have an array that looks like [products] => Array ( [0] => stdClass
I have a json file that looks like this: { status: 200, data: {
I'm new to the GSON library, I have a json data structure that looks
I have an object in Javascript that looks like this function MyObject(){ this.name=; this.id=0;
I have Django model that looks like this: class Categories(models.Model): Model for storing the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.