Issue
I am using the following code borrowed from here, to generate a zoomed-in plot inside a plot :
import numpy as np
from matplotlib import pyplot as plt
# Generate the main data
X = np.linspace(-6, 6, 1024)
Y = np.sinc(X)
# Generate data for the zoomed portion
X_detail = np.linspace(-3, 3, 1024)
Y_detail = np.sinc(X_detail)
# plot the main figure
plt.plot(X, Y, c = 'k')
# location for the zoomed portion
sub_axes = plt.axes([.6, .6, .25, .25])
# plot the zoomed portion
sub_axes.plot(X_detail, Y_detail, c = 'k')
plt.show()
To adjust the font size of the ticks of the zoomed-in plot, I tried the following:
sub_axes.xticks(fontsize=12)
There is an error which says " 'Axes' object has no attribute 'xticks' ".
How to set the font size of the ticks of the zoomed-in plot?
Solution
Try using plt.xticks(fontsize=12)
Answered By - Skandan Senthil Nathan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.