Any python/matplotlib experts out there?? This one has been driving me crazy all day. I have three vectors, azimuth, frequency and power, which I would like to histogram and plot on a polar axis. I can plot a scatter plot this way no problem but the histogram gets messed up somehow. An example is below, anybody know how to do this properly??(adsbygoogle = window.adsbygoogle || []).push({});

import random

import numpy as np

import matplotlib.pyplot as plt

baz = np.zeros((20))

freq = np.zeros((20))

pwr = np.zeros((20))

for x in range(20):

baz[x] = random.randint(20,25)*10

freq[x] = random.randint(1,10)*10

pwr[x] = random.randint(-10,-1)*10

baz = baz*np.pi/180.

abins = np.linspace(0,2*np.pi,360)

sbins = np.linspace(1, 100)

H, xedges, yedges = np.histogram2d(baz, freq, bins=(abins,sbins), weights=pwr)

plt.figure(figsize=(14,14))

plt.subplot(111, polar=True)

#plt.scatter(baz, freq, c=pwr)

plt.pcolormesh(H)

plt.show()

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Python, matplotlib plot 2D histogram on polar axis.

Loading...

Similar Threads for Python matplotlib plot | Date |
---|---|

Mathematica Polynomial expansion from Python to Mathematica | Feb 20, 2018 |

LaTeX Printing Code from Python in Latex via "minted" | Sep 7, 2017 |

Intel Distribution for Python | May 28, 2017 |

What are the good books for physics and python? | Oct 8, 2015 |

Mathematica vs gnuplot vs matplotlib (efficency) | Oct 10, 2010 |

**Physics Forums - The Fusion of Science and Community**