Answers for "how to add percentages to ylabel python"

0

how to add percentages to ylabel python

import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.randn(100,5))

# you get ax from here
ax = df.plot()
type(ax)  # matplotlib.axes._subplots.AxesSubplot

# manipulate
vals = ax.get_yticks()
ax.set_yticklabels(['{:,.2%}'.format(x) for x in vals])
Posted by: Guest on March-18-2022

Code answers related to "how to add percentages to ylabel python"

Python Answers by Framework

Browse Popular Code Answers by Language