I want to plot a bar plot with this code:
graph_data = pd.read_csv('data.csv', usecols = ['X', 'Y'])
ax = graph_data.plot.bar(x='X', y='Y', figsize=(15, 5))
plt.title("X [-]")
plt.ylim([0,1120394]) #Max value from the dataset
plt.show()
- I read the data from
.csv
file - Then I specify the
ylim
to[0,1120394]
(which is the highest value in the dataset). - And plot the bar plot
The output plot:
- As you can see the bars
S29
,S30
,S33
,S34
andS37
are cut. - I want to plot a bar plot that will show the full length of each column.
- Also I would love if
Y
axis could show me the actual values? Why is it showing1e6
?
Edit
If I use the answer (and other answer referring to this) pointed out by the comments I end up with this code:
plt.ticklabel_format(style='plain') #To set off scientific notation
...
or
...
plt.ticklabel_format(useOffset=False)
Both lines get me those errors:
AttributeError: This method only works with the ScalarFormatter