[PYTHON] Show dividing lines in matplotlib histogram

--Previously, when I displayed the histogram (probably), the boundary line (dividing line) of the bar appeared. --Add ʻec ='black'` to the options of hist function

Uses Python 3.6.0, matplotlib 2.0.0

Confirmed operation with Jupyter-notebook

By default, the bars of each histogram are not split

For example, with the code below, the boundary between each bar does not appear.

% matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

plt.hist(np.random.randn(100))

hist1.png


I wonder if it has changed from matplotlib 2.0.0 ...

When I read the document, I can't find anything like that in the options.

So, when I looked it up, the following hits

python - Cannot get histogram to show separated bins with vertical lines - Stack Overflow

Just add ʻec ='black'` to the hist function of pyplot as shown in the code below.

% matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

plt.hist(np.random.randn(100), ec='black')

hist2.png

――Of course, you can specify another color such as ʻec ='red'`, so you should try various things. --ec is an abbreviation for edge color


(If you are told to use seaborn ...)

Recommended Posts

Show dividing lines in matplotlib histogram
Show axes as percentages in Matplotlib
Histogram with matplotlib
Put matplotlib in Centos7.
Show pyramids in Python
View images in Matplotlib
2D plot in matplotlib
Show decimal point in Python
[Python 3] Prime factorization in 14 lines
Embed matplotlib graphs in Tkinter
behavior of matplotlib: histogram normed
Implement UnionFind (equivalent) in 10 lines
Make python segfault in 2 lines
Histogram parameter excerpt from matplotlib
Python install in 2 lines @Windows
Show Django ManyToManyField in Template