小编pja*_*ain的帖子

如何在一个图中绘制极坐标和笛卡尔子图,如图所示

我想生成一个半笛卡尔半极坐标图。例如,高斯曲线的一半采用极坐标格式,另一半采用笛卡尔格式。哪个是最好的方法?

半笛卡尔半极坐标图

我尝试过共享 y 轴,但未能成功为一个图采用两种不同类型的格式。

import matplotlib.pyplot as plt
import numpy as np

theta = np.linspace(0,(np.pi)/2)
r = np.sin(theta)

fig = plt.figure()
ax = fig.add_subplot(211, polar=True)
c = ax.scatter(theta, r, c=r, s=5, cmap='hsv', alpha=0.85)

ax.set_thetamin(0)
ax.set_thetamax(90)

ax1=fig.add_subplot(212) #, sharey='ax')
fig, (c, d) = plt.subplots(ncols=2,sharey=True)
d=ax1.scatter(theta,r)
plt.show() 
Run Code Online (Sandbox Code Playgroud)

matplotlib cartesian subplot polar-coordinates

2
推荐指数
1
解决办法
4586
查看次数