【问题标题】:Trouble in creating graphics with matplotlib in a Jupyter notebook [duplicate]在 Jupyter 笔记本中使用 matplotlib 创建图形时遇到问题 [重复]
【发布时间】:2018-06-24 08:18:06
【问题描述】:

按照 pandas 可视化文档 (https://pandas.pydata.org/pandas-docs/stable/visualization.html#visualization-hist) 我正在尝试创建以下图形:

import numpy as np
import pandas as pd 
import matplotlib.pyplot as plt
## A data set in my AzureML workplace experiment 
df = ds.to_dataframe()
plt.figure(); 
df.plot.hist(stacked=True, bins=20) 
plt.figure();df.boxplot()

但是,输出仅限于"<matplotlib.axes._subplots.AxesSubplot at 0x7fd12e15dc18>"(用于直方图(=)和<matplotlib.axes._subplots.AxesSubplot at 0x7fd12e0ce828>"(用于箱形图),但没有出现图像。谁能帮我确定我错过了什么?谢谢!

我在 AzureML 的 Jupyter Notebook 中使用 Python 3。

df.describe()方法正常工作(有dataFrame)

【问题讨论】:

  • 嗨,@ImportanceOfBeingErnest,不要说“这个问题以前被问过”。是的,在“How to make IPython notebook matplotlib plot inline”中有这个问题的答案,但是质疑它的方式不同,也许我的问题可以帮助那些在 Jupyter notebook 中使用 matplotlib 创建图形时遇到问题的人"。
  • 这正是标记为重复的目的。无论人们现在是否会寻找“创建图形时遇到问题......”或“如何制作 IPython......”,他们都会被引导到相同的解决方案。
  • 好的,@ImportanceOfBeingErnest,谢谢。

标签: python pandas matplotlib azure-machine-learning-studio


【解决方案1】:

你设置后端了吗?

%matplotlib inline

也值得在这里阅读一下这对笔记本的作用 Purpose of "%matplotlib inline"

【讨论】:

    猜你喜欢
    • 2021-03-22
    • 2020-09-05
    • 1970-01-01
    • 1970-01-01
    • 2020-08-12
    • 2017-05-15
    • 2018-06-11
    • 1970-01-01
    • 2023-01-15
    相关资源
    最近更新 更多