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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:58:03+00:00 2026-05-29T10:58:03+00:00

I need to generate a stack of 2D polar plots (a 3D cylindrical plot)

  • 0

I need to generate a stack of 2D polar plots (a 3D cylindrical plot) so that I can view a distorted cylinder. I want to use matplotlib since I already have it installed and want to distribute my code to others who only have matplotlib. For example, say I have a bunch of 2-D arrays. Is there any way I can do this without having to download an external package? Here’s my code.

#!usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np

x = np.arange(-180.0,190.0,10)
theta = (np.pi/180.0 )*x    # in radians

A0 = 55.0
offset = 60.0

R = [116.225,115.105,114.697,115.008,115.908,117.184,118.61,119.998,121.224,122.216,\
122.93,123.323,123.343,122.948,122.134,120.963,119.575,118.165,116.941,116.074,115.66\
,115.706,116.154,116.913,117.894,119.029,120.261,121.518,122.684,123.594,124.059,\
123.917,123.096,121.661,119.821,117.894,116.225]

fig = plt.figure()
ax = fig.add_axes([0.1,0.1,0.8,0.8],polar=True)     # Polar plot
ax.plot(theta,R,lw=2.5)
ax.set_rmax(1.5*(A0)+offset)
plt.show()

I have 10 more similar 2D polar plots and I want to stack them up nicely. If there’s any better way to visualize a distorted cylinder in 3D, I’m totally open to suggestions. Any help would be appreciated. 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-05-29T10:58:04+00:00Added an answer on May 29, 2026 at 10:58 am

    If you want to stack polar charts using matplotlib, one approach is to use the Axes3D module. You’ll notice that I used polar coordinates first and then converted them back to Cartesian when I was ready to plot them.

    from numpy import *
    from mpl_toolkits.mplot3d import Axes3D
    import matplotlib.pyplot as plt
    
    n = 1000
    
    fig = plt.figure()
    ax = fig.gca(projection='3d')
    
    for k in linspace(0, 5, 5):
        THETA = linspace(0, 2*pi, n)
        R     = ones(THETA.shape)*cos(THETA*k)
    
        # Convert to Cartesian coordinates
        X = R*cos(THETA)
        Y = R*sin(THETA)
    
        ax.plot(X, Y, k-2)
    
    plt.show()
    

    enter image description here

    If you play with the last argument of ax.plot, it controls the height of each slice. For example, if you want to project all of your data down to a single axis you would use ax.plot(X, Y, 0). For a more exotic example, you can map the height of the data onto a function, say a saddle ax.plot(X, Y, -X**2+Y**2 ). By playing with the colors as well, you could in theory represent multiple 4 dimensional datasets (though I’m not sure how clear this would be). Examples below:

    enter image description here

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

Sidebar

Related Questions

I need to generate some passwords, I want to avoid characters that can be
I need generate action links outside controllers. I can use Html.Action in Views, Url.Action
I need generate thumbnails for a bunch of jpegs (200,000+) but I want to
I need to generate thumbnails from a set of jpg's that need to have
I need to generate an XML file in C#. I want to write the
I have a custom view controller that I push onto my navigation stack as
I need to generate an RSS feed for posts in WordPress that contains more
I need to generate a random integer between 1 and n (where n is
I need to generate a directory in my makefile and I would like to
I need to generate multiple random values under SQL Server 2005 and somehow this

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.