Reputation: 1827
I'm wanting to remove the vertical bar outlines from my histogram plot, but preserving the "etching" of the histogram, if that makes since.
import matplotlib.pyplot as plt
import numpy as np
bins = 35
fig = plt.figure(figsize=(7,6))
ax = fig.add_subplot(111)
ax.hist(subVel_Hydro1, bins=bins, facecolor='none',
edgecolor='black', label = 'Pecuiliar Vel')
ax.set_xlabel('$v_{_{B|A}} $ [$km\ s^{-1}$]', fontsize = 16)
ax.set_ylabel(r'$P\ (r_{_{B|A}} )$', fontsize = 16)
ax.legend(frameon=False)
Giving
Is this doable in matplotlibs histogram functionality? I hope I provided enough clarity.
Upvotes: 5
Views: 5018
Reputation: 1667
In pyplot.hist()
you could set the value of histtype = 'step'
. Example code:
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
x = np.random.normal(0,1,size=1000)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.hist(x, bins=50, histtype = 'step', fill = None)
plt.show()
Sample output:
Upvotes: 8