histogram graph line style in matplotlib

Have you imported all the libraries you need? Also, sometimes not all linestyles are available to all plot types. There are linestyles that work for plots that do not work on vectors (even though they look like they should), for example. When the symbol name does not work '--' it is a good idea to try the named version 'dashed'.

You can provide a tuple of linestyles (or colors, widths, etc.) in the plot argument much like how it is done for linewidths on this example from the matplotlib docs (Ctrl+F for linewidths)

Using your plot command, it should look like:

plt.hist(data1,bins=40,normed=True,histtype='step',linestyle=('solid','dashed'))

There is a color argument you can specify just like how linestyle was done. When the lines are plotted, pyplot looks at the first item in each tuple you provide. So if you wanted a solid black line and a dashed yellow line it would look like

plt.hist(data1,bins=40,normed=True,histtype='step',linestyle=('solid','dashed'),color=('black','k'))

So 'solid' should pair with 'black' and 'dashed' should pair with 'k'. This should work for any other line properties you want to use.


The edgecolor parameter worked on mine.

plot.hist (bins = 10, xlim = [0.0,1], ylim = [0.0,70], color = 'blue', edgecolor = 'black')