Reputation: 1129
When creating a figure using plt.figure, one can set its size and resolution in the following way:
plt.figure(num=1, figsize=(6, 4), dpi=150)
How can this be obtained when creating a figure using the following code?
fig, ax = plt.subplots()
I've tried the code bellow but I get the error TypeError: 'Figure' object is not callable
ax.figure(num=1, figsize=(6, 4), dpi=150)
Thanks for your help and suggestions!
Upvotes: 1
Views: 2087
Reputation: 574
plt.subplots()
supports all the keyword parameters of plt.figure()
, so to change the resolution, just do:
fig, ax = plt.subplots(dpi=150)
Take a look at the docs:
EDIT: The reason your code isn't working is because ax.figure
is a Figure object, not a function. This is why it's "not callable."
Upvotes: 3