You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: matplotlib.sphinxext.plot_directive: Changing DPI value in plot_formats leads to unexpected figure sizes #32699
When using the plot:: directive in Sphinx (i.e., using matplotlib.sphinxext.plot_directive): Modifying the resolution via the configuration variable plot_formats in Sphinx's conf.py leads to unexpected sizes of the resulting figures:
Setting plot_formats = ['png'] produces:
The first image is made up 160x160 pixels and the second image is made up of 320x320 pixel.
I investigated this locally. The generated PNG dimensions scale with DPI, while the first plot has no explicit HTML width. I also tested Sphinx's standard figure directive and observed the same default behavior. An explicit :width: keeps the displayed size fixed. Is automatic physical-size preservation the intended behavior for plot_directive?
Activity
susmita9878 commentedon Dec 4, 2026
Hi, I'd like to investigate this issue and work on a fix with a regression test. Is anyone currently working on it?
susmita9878 commentedon Dec 4, 2026
I investigated this locally. The generated PNG dimensions scale with DPI, while the first plot has no explicit HTML width. I also tested Sphinx's standard
figuredirective and observed the same default behavior. An explicit:width:keeps the displayed size fixed. Is automatic physical-size preservation the intended behavior forplot_directive?