【问题标题】:not getting plot while using ipython in miniconda在 miniconda 中使用 ipython 时没有得到情节
【发布时间】:2020-09-05 08:23:52
【问题描述】:

当我在 ipython 中使用 matplotlib 时,我没有得到任何情节。代码如下:

%matplotlib inline
import matplotlib.pyplot as plt
sns.set() # use Seaborn styles
births.pivot_table('births', index='year', columns='gender', aggfunc='sum').plot()
plt.ylabel('total births per year');

我得到一个输出:

<Figure size 432x288 with 1 Axes>

这是我在运行代码时得到的输出:

【问题讨论】:

  • 任何帮助表示赞赏。
  • plt.show() 呢?
  • 我在 IPython 上发生了类似的行为。我重新启动了 IPython,然后它工作了。
  • @PéterLeéh 它仍然显示相同的结果。
  • 请原谅我对 miniconda 的无知,但它对我来说只是命令窗口。你真的在使用 iPython 编辑器吗?命令窗口不会显示 matplotlib 输出。

标签: python pandas matplotlib plot miniconda


【解决方案1】:

当我在代码开头使用 %matplotlib 时,我得到了答案。这对我来说是如何工作的。

【讨论】:

    猜你喜欢
    • 2020-09-07
    • 1970-01-01
    • 2017-11-07
    • 2020-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-22
    • 2017-02-22
    相关资源
    最近更新 更多