Home > Blockchain >  Plot Between Certain Y axis Values
Plot Between Certain Y axis Values

Time:04-22

I'm plotting some values using Pandas. But my Values are soo close together It doesn't actually show anything. Is there a way to restrict Y-axis to "Zoom in" on the differences?

import pandas as pd

Visualisation_data = [
['Name', 'Precision', 'Recall', 'Fscore'], 
['Nearest Neighbors', 0.9941092491040373, 0.9941120807486069, 0.9941104313566096], 
['Decision Tree', 0.9907466809790595, 0.9905372726316897, 0.9905799514473057], 
['Random Forest', 0.9904390940784943, 0.9902218483860793, 0.9902666023565283], 
['Neural Net', 0.9889258082623311, 0.9886447271580275, 0.9887034953541715], 
['AdaBoost', 0.9898997339726043, 0.9898012827252655, 0.9898287217849503], 
['Naive Bayes', 0.9879327102321881, 0.9878035958364, 0.9878405516638376], 
['QDA', 0.987792949034618, 0.9876984544211965, 0.9877281981429068], 
['Gradient Boosting', 0.9913344316304186, 0.9911681211229103, 0.991203224587695],
['LogisticRegression', 0.9880441911047473, 0.9876984544211965, 0.987769435249051]]


bplot = pd.DataFrame(Visualisation_data, columns=["Name", "Precision", "Recall", "Fscore"])

bplot.plot.bar( x = 'Name');

And then really show the difference between the value even though there isn't much..?

CodePudding user response:

You can adjust the y-axis start and end by replacing the last line bplot.plot.bar( x = 'Name') by below code.

ax = bplot.plot.bar( x = 'Name')
ax.set_ylim(0.98,1)

This is the updated graph enter image description here

CodePudding user response:

Increase the size of the figure object. In your bplot.plot.bar( x = 'Name') add additional argument figsize and calibrate it according to your need.

  • Related