python - How to change plot from connecting points to vertical sticks? -


the following code create plot connecting points.

import numpy np import matplotlib.pyplot plt  x = np.arange(0, 5, 0.1); y = np.sin(x) plt.plot(x, y) plt.show() 

enter image description here

how can change plot vertical sticks instead of connecting points? i.e., change type of plot of following example:

enter image description here

thanks.

use plt.bar

import numpy np import matplotlib.pyplot plt  x = np.arange(0, 5, 0.1); y = np.sin(x) plt.bar(x, y, width=0.08,edgecolor='none',color='k',align='center') plt.show() 

enter image description here


Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -