Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Plot Between Certain Y axis Values

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..?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading