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 8862999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:51:58+00:00 2026-06-14T15:51:58+00:00

Suppose you have a 2D curve, given by e.g.: from matplotlib import pylab t

  • 0

Suppose you have a 2D curve, given by e.g.:

from matplotlib import pylab
t = numpy.linspace(-1, 1, 21)
z = -t**2
pylab.plot(t, z)

which produces

http://i.imgur.com/feQzk.png

I would like to perform a revolution to achieve a 3d plot (see http://reference.wolfram.com/mathematica/ref/RevolutionPlot3D.html). Plotting a 3d surface is not the problem, but it does not produce the result I’m expecting:

http://i.imgur.com/ljXHQ.png

How can I perform a rotation of this blue curve in the 3d plot ?

  • 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-14T15:51:59+00:00Added an answer on June 14, 2026 at 3:51 pm

    Your plot on your figure seems to use cartesian grid. There is some examples on the matplotlib website of 3D cylindrical functions like Z = f(R) (here: http://matplotlib.org/examples/mplot3d/surface3d_radial_demo.html).
    Is that what you looking for ?
    Below is what I get with your function Z = -R**2 :Plot of Z = -R**2 function

    And to add cut off to your function, use the following example:
    (matplotlib 1.2.0 required)

    from mpl_toolkits.mplot3d import Axes3D
    from matplotlib import cm
    import matplotlib.pyplot as plt
    import numpy as np
    
    fig = plt.figure()
    ax = fig.gca(projection='3d')
    X = np.arange(-5, 5, 0.25)
    Y = np.arange(-5, 5, 0.25)
    X, Y = np.meshgrid(X, Y)
    
    Z = -(abs(X) + abs(Y))
    
    ## 1) Initial surface
    # Flatten mesh arrays, necessary for plot_trisurf function
    X = X.flatten()
    Y = Y.flatten()
    Z = Z.flatten()
    
    # Plot initial 3D surface with triangles (more flexible than quad)
    #surfi = ax.plot_trisurf(X, Y, Z, cmap=cm.jet, linewidth=0.2)
    
    ## 2) Cut off
    # Get desired values indexes
    cut_idx = np.where(Z > -5)
    
    # Apply the "cut off"
    Xc = X[cut_idx]
    Yc = Y[cut_idx]
    Zc = Z[cut_idx]
    
    # Plot the new surface (it would be impossible with quad grid)
    surfc = ax.plot_trisurf(Xc, Yc, Zc, cmap=cm.jet, linewidth=0.2)
    
    # You can force limit if you want to compare both graphs...
    ax.set_xlim(-5,5)
    ax.set_ylim(-5,5)
    ax.set_zlim(-10,0)
    
    plt.show()
    

    Result for surfi:

    surfi

    and surfc:

    surfc

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets suppose I have n curves, which together enclose some region. How to plot
Suppose we have the name written in any none-latin letters - languages, like Arabic,
Suppose I have a class Baz that inherits from classes Foo and Bar ,
Suppose that I have a multimap (which maps multiple values to a single key),
Suppose I have a data frame, df, that looks like: f t1 t2 t3
I have a problem. Suppose we have a single cubic bezier curve defined by
Suppose I have a table like: Tab(MyDate datetime null, MyIs bit null, ...) Then
suppose I have a html markup like this: <div> <p> this is the parent
Suppose I have a ASP.NET Web API controller that uses a service, which in
Suppose I have a grid of squared defined like so in a class: Square

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.