Q. Write a program to create a histogram that plots two ndarrays x and y with 48 bins, in stacked horizontal histogram and add plot title and axes titles to above plot.


df
   speed  meters  weight
0     10     122    0.20
1     15     150    0.30
2     20     190    0.10
3     18     230    0.85
4     19     300    0.00

Answer :-

import matplotlib.pyplot as pl

# df created

pl.scatter( df['meters'], df['weight'])
pl.hist ([y, x], bins = 48, orientation = 'horizontal', histtype = 'barstacked')

pl.title ("horizontal stackedbar hhistogram")
pl.xlabel ("X-axis")
pl.ylabel ("Y-axis")
pl.show()

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post