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?
JavaScript
x
19
19
1
import pandas as pd
2
3
Visualisation_data = [
4
['Name', 'Precision', 'Recall', 'Fscore'],
5
['Nearest Neighbors', 0.9941092491040373, 0.9941120807486069, 0.9941104313566096],
6
['Decision Tree', 0.9907466809790595, 0.9905372726316897, 0.9905799514473057],
7
['Random Forest', 0.9904390940784943, 0.9902218483860793, 0.9902666023565283],
8
['Neural Net', 0.9889258082623311, 0.9886447271580275, 0.9887034953541715],
9
['AdaBoost', 0.9898997339726043, 0.9898012827252655, 0.9898287217849503],
10
['Naive Bayes', 0.9879327102321881, 0.9878035958364, 0.9878405516638376],
11
['QDA', 0.987792949034618, 0.9876984544211965, 0.9877281981429068],
12
['Gradient Boosting', 0.9913344316304186, 0.9911681211229103, 0.991203224587695],
13
['LogisticRegression', 0.9880441911047473, 0.9876984544211965, 0.987769435249051]]
14
15
16
bplot = pd.DataFrame(Visualisation_data, columns=["Name", "Precision", "Recall", "Fscore"])
17
18
bplot.plot.bar( x = 'Name');
19
And then really show the difference between the value even though there isn’t much..?
Advertisement
Answer
You can adjust the y-axis start and end by replacing the last line bplot.plot.bar( x = 'Name')
by below code.
JavaScript
1
3
1
ax = bplot.plot.bar( x = 'Name')
2
ax.set_ylim(0.98,1)
3