I'm working with matplotlib pylab backend_inline
This code set figure and Axes in different colors
fig, ax = plt.subplots()
ax.set_facecolor('xkcd:salmon')
fig.patch.set_facecolor('k')
and plot this figure
so that it's easy to measure the length for the figure and Axes.
I estimated the length and got Axes/figure
is equal to about 90%.
However, a so post gives this code
bbox = ax.get_window_extent().transformed(fig.dpi_scale_trans.inverted())
width, height = bbox.width, bbox.height
to get width and height of the Axes.
and I got this value
(4.6499999999999995, 3.0199999999999996)
fig.get_size_inches()
gives array([6., 4.])
this code gives the same result
bbox = fig.get_window_extent().transformed(fig.dpi_scale_trans.inverted())
which results in a ratio of 77.5%, which is quite different from the ratio I measured.
However, when I saved the figure to a file,
plt.savefig("ax_fig_ratio")
I got this
which has the expected ratio.
How do I get the actual size of the figure and Axes for the first figure rendered inline?
How do I make matplotlib inline_backend render the figure in width of 6 inches and Axes in 4.65 inches, as fig.get_size_inches()
indicates?
According to @JodyKlymak, the figure size is trimmed. If it is true, how do I disable the trimming feature so that I can get the full-size figure?