Utilizing matplotlib.pyplot library in python draw a visual diagram with two qualities for examination, utilizing various hues.
Issue articulation: Using matplotlib.pyplot library in python draw a reference chart with two qualities for examination, utilizing various hues.
import matplotlib.pyplot as plt x1 = [2,4,6,8,10] y1=[3,9,11,2,6] x2=[1,3,5,7,9] y2=[6,4,7,8,3] plt.bar(x1,y1,label ='Bars1', color='g') plt.bar(x2,y2,label = 'Bars2', color='r') plt.xlabel('X-axis') plt.ylabel('Y-axis') plt.title('Bar Graph2') plt.legend() plt.show()
Python library matplotlib.pyplot is utilized to draw the above graph. Four arbitrary factors x1 y1 and x2 y2 are taken with irregular qualities. The bar work plots a bar plot.
The subsequent bar work utilized draws another bar plot in a similar casing. The bar work takes 2 contentions, for example, x and y and a marked variable give the name to the plot.
To give the title to the plot the title work is utilized. To show the legend work is utilized lastly to show the plot the show work.