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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:01:45+00:00 2026-06-05T04:01:45+00:00

I’ve got a bunch of regularly distributed points (θ = n*π/6, r=1…8), each having

  • 0

I’ve got a bunch of regularly distributed points (θ = n*π/6, r=1…8), each having a value in [0, 1]. I can plot them with their values in matplotlib using

polar(thetas, rs, c=values)

But rather then having just a meagre little dot I’d like to shade the corresponding ‘cell’ (ie. everything until halfway to the adjacent points) with the colour corresponding to the point’s value:

Polar plot with shaded cells

(Note that here my values are just [0, .5, 1], in really they will be everything between 0 and 1. Is there any straight-forward way of realising this (or something close enough) with matplotlib? Maybe it’s easier to think about it as a 2D-histogram?

  • 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-05T04:01:47+00:00Added an answer on June 5, 2026 at 4:01 am

    Sure! Just use pcolormesh on a polar axes.

    E.g.

    import matplotlib.pyplot as plt
    import numpy as np
    
    # Generate some data...
    # Note that all of these are _2D_ arrays, so that we can use meshgrid
    # You'll need to "grid" your data to use pcolormesh if it's un-ordered points
    theta, r = np.mgrid[0:2*np.pi:20j, 0:1:10j]
    z = np.random.random(theta.size).reshape(theta.shape)
    
    
    fig, (ax1, ax2) = plt.subplots(ncols=2, subplot_kw=dict(projection='polar'))
    
    
    ax1.scatter(theta.flatten(), r.flatten(), c=z.flatten())
    ax1.set_title('Scattered Points')
    
    ax2.pcolormesh(theta, r, z)
    ax2.set_title('Cells')
    
    for ax in [ax1, ax2]:
        ax.set_ylim([0, 1])
        ax.set_yticklabels([])
    
    plt.show()
    

    enter image description here

    If your data isn’t already on a regular grid, then you’ll need to grid it to use pcolormesh.

    It looks like it’s on a regular grid from your plot, though. In that case, gridding it is quite simple. If it’s already ordered, it may be as simple as calling reshape. Otherwise, a simple loop or exploiting numpy.histogram2d with your z values as weights will do what you need.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
i got an object with contents of html markup in it, for example: string
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Does anyone know how can I replace this 2 symbol below from the string
I'm having trouble keeping the paragraph square between the quote marks. In firefox 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.