How to adjust the ticks and label size of a pandas plot with secondary_y
I have a plot with a left and right y-axis created with pandas.DataFrame.plot
and specifying secondary_y=True
.
I want to increase the font sizes of the y-axis tick params, but it seems that only the left side y-axis font size is increasing.
import pandas as pd
import numpy as np
# sample dataframe
sample_length = range(1, 2+1)
rads = np.arange(0, 2*np.pi, 0.01)
data = np.array([np.sin(t*rads) for t in sample_length])
df = pd.DataFrame(data.T, index=pd.Series(rads.tolist(), name='radians'), columns=[f'freq: {i}x' for i in sample_length])
# display(df.head(3))
freq: 1x freq: 2x
radians
0.00 0.000000 0.000000
0.01 0.010000 0.019999
0.02 0.019999 0.039989
# plot
ax1 = df.plot(y='freq: 1x', ylabel='left-Y')
ax2 = df.plot(y='freq: 2x', secondary_y=True, ax=ax1)
What is the way to increase the font size for the right y-axis?
from Recent Questions - Stack Overflow https://ift.tt/315nVau
https://ift.tt/3p909Ti
Comments
Post a Comment