具有大量点的Matplotlib极坐标图会失真 [英] Matplotlib polar plot with large number of points gets distorted

查看:63
本文介绍了具有大量点的Matplotlib极坐标图会失真的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在极坐标散点图上绘制大量数据点.我知道我的数据从笛卡尔图中看起来如何,我很快注意到它在极坐标图中扭曲了.现在,如果我只是绘制绘制数据的网格,它已经是不规则和扭曲的.

I want to plot a large number of data points on a polar scatter plot. I know how my data looks like from a cartesian plot, and I quickly noticed it got distorted on the polar plot. Now if I just plot the grid over which the data is plotted, it is already non-regular and distorted.

这是我的代码:

import numpy as np
import matplotlib.pyplot as plt

azimuths = np.linspace(0,2*np.pi,2000) # azimuthal angles
zeniths = np.linspace(0,100,200) # zenith is basically the radial extent of the plot
phi,r = np.meshgrid(azimuths,zeniths) # make the grid for the polar plot
fig, ax = plt.subplots(subplot_kw=dict(projection='polar'),figsize=(10,10)) # initialize figure
j=ax.scatter(phi,r,s=0.01) # make scatter plot
ax.set_rlim(0,100) # set radial limits

产生下图:

我想知道是否有人知道一种在极坐标图上创建统一网格的方法,对于这个数量的数据点,不会出现奇怪的波纹.

I wonder if someone knows a way to create a uniform grid over the polar plot where no weird ripples appear, for this number of data points.

推荐答案

增加 dpi 参数 - 默认为 100.同时考虑增加 figsize.涟漪效应是显示故障,因此应该可以解决问题.

Increase the dpi parameter - the default is 100. Also consider increasing the figsize. The ripple effect is a display glitch, so this should fix things.

fig, ax = plt.subplots(subplot_kw=dict(projection='polar'),figsize=(10,10), dpi=200)

签出此此处.

这篇关于具有大量点的Matplotlib极坐标图会失真的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆