小编Tri*_*ima的帖子

在Python3中运行TextBlob

我使用这里给出的pip安装了textblob .

现在,当我尝试在终端中的python3.4中导入它时,它说

ImportError: No module named 'textblob'
Run Code Online (Sandbox Code Playgroud)

然而,在python2.7中它很愉快地导入.我试过重新安装它.我甚至重新安装了pip.这里有什么问题?

python python-3.4 textblob

6
推荐指数
1
解决办法
2370
查看次数

带极轴的条形图

我想让我的情节与此类似-

在此处输入图片说明

目前,我能得到的是:

在此处输入图片说明

我无法执行以下操作:

  1. 获取内圈内的时间标签
  2. 获取圆圈内的刻度。这个问题 - How to create minor ticks for polar plot matplotlib,有一个我尝试过的想法,但它与情节的其他部分搞砸了。
  3. 时间标签仅在步长为 3 时才能正常工作。对于其他步长,它不会与条形对齐。

以下是生成绘图的可重现代码

arr = np.random.randint(0, 24, size = 50000)
df = pd.DataFrame({"COL": arr}).COL.value_counts().sort_index()

N = 24
bottom = 1000
theta, width = np.linspace(0.0, 2 * np.pi, N, endpoint=False, retstep=True)

plt.figure(figsize = (10, 6))
ax = plt.subplot(111, polar=True)

bars = ax.bar(
    theta, df,
    width=width-0.03,
    bottom=bottom,
    color="#f39c12", edgecolor="black"
)
bars = ax.bar(
    theta, [3000]*24,
    width=width-0.03,
    bottom=bottom,
    color="#f39c12", alpha=0.2
)

ax.set_theta_zero_location("N")
ax.set_theta_direction(-1)
ax.grid(False)
ax.spines['polar'].set_visible(False)
ax.set_rticks([]) …
Run Code Online (Sandbox Code Playgroud)

python matplotlib python-3.x polar-coordinates

5
推荐指数
1
解决办法
2538
查看次数