I'm struggling to correctly apply Integerlabels to the AxesSubplot Object. Somehow all the other popular solutions don't work. I presume this has to do with the nature of how Pandas plots vs how Matplotlib natively plots a dataframe.
When looking at the docs, there is a mention about preventing resolution adjustments by using the optional parameter x_compat like so:
df['A'].plot(x_compat=True)
However this only throws me an error and I also can't find this parameter in the pandas 1.1.2 docs.
This is the code that produces the plot:
def count_id(id_val):
plot = df[df['ID']==id_val]['TRANSCRIPTION_STRING'].value_counts().plot(kind='bar')
plot.set_xticklabels(plot.get_xticklabels(), rotation=40, ha ='right')
print(type(plot))
I have found this answer and it wasn't helpful for the following reasons:
- It uses
.gca()which throws an error for my case. - It's specifically using
matplotlibinstead ofpandas.plot, which is the same under the hood, but hardly has very different documentation and isn't obvious to work for my case. More experienced users might differ.
It was a good suggestion and I see the similarities, but I very much tried to find it helpful before asking and it just wasn't helpful.
