Python直方图轮廓 [英] Python histogram outline

查看:212
本文介绍了Python直方图轮廓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Jupyter(Python 2)中绘制了一个直方图,希望看到我的柱形的轮廓,但是事实并非如此.

I have plotted a histogram in Jupyter (Python 2) and was expecting to see the outlines of my bars but this is not the case.

我正在使用以下代码:

import matplotlib.pyplot as plt
from numpy.random import normal
gaussian_numbers = normal(size=1000)
plt.hist(gaussian_numbers)
plt.title("Gaussian Histogram")
plt.xlabel("Value")
plt.ylabel("Frequency")
plt.show()

推荐答案

您的linewidth设置为零或edgecolor设置为'none'. Matplotlib在2.0中更改了这些默认设置.尝试使用:

It looks like either your linewidth was set to zero or your edgecolor was set to 'none'. Matplotlib changed the defaults for these in 2.0. Try using:

plt.hist(gaussian_numbers, edgecolor='black', linewidth=1.2)

这篇关于Python直方图轮廓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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