本文簡要介紹 python 語言中 matplotlib.sphinxext.figmpl_directive.FigureMpl
的用法。
-
實現一個指令以允許可選的 hidpi 圖像。
旨在與 conf.py 中的
plot_srcset
配置選項一起使用,並在 plot_directive.py 的模板中設置例如:
.. figure-mpl:: plot_directive/some_plots-1.png :alt: bar :srcset: plot_directive/some_plots-1.png, plot_directive/some_plots-1.2x.png 2.00x :class: plot-directive
生成的 html(位於
some_plots.html
)為:<img src="sphx_glr_bar_001_hidpi.png" srcset="_images/some_plot-1.png, _images/some_plots-1.2x.png 2.00x", alt="bar" class="plot_directive" />
請注意,子目錄的處理與 sphinx 圖指令使用的不同:
.. figure-mpl:: plot_directive/nestedpage/index-1.png :alt: bar :srcset: plot_directive/nestedpage/index-1.png plot_directive/nestedpage/index-1.2x.png 2.00x :class: plot_directive
生成的 html(位於
nestedpage/index.html
):<img src="../_images/nestedpage-index-1.png" srcset="../_images/nestedpage-index-1.png, ../_images/_images/nestedpage-index-1.2x.png 2.00x", alt="bar" class="sphx-glr-single-img" />
其中子目錄包含在圖像名稱中以確保唯一性。
用法
class matplotlib.sphinxext.figmpl_directive.FigureMpl(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)
相關用法
- Python matplotlib Figure.set_size_inches用法及代碼示例
- Python matplotlib Figure.add_axes用法及代碼示例
- Python matplotlib FigureBase.subplots用法及代碼示例
- Python matplotlib FigureBase.align_ylabels用法及代碼示例
- Python matplotlib FigureBase.align_xlabels用法及代碼示例
- Python matplotlib FigureBase.add_axes用法及代碼示例
- Python matplotlib FigureBase.legend用法及代碼示例
- Python matplotlib FigureCanvasBase.mpl_connect用法及代碼示例
- Python matplotlib Figure.figimage用法及代碼示例
- Python matplotlib Figure.add_subplot用法及代碼示例
- Python matplotlib Figure.legend用法及代碼示例
- Python matplotlib FigureBase.sticky_edges用法及代碼示例
- Python matplotlib FigureCanvasBase.mpl_disconnect用法及代碼示例
- Python matplotlib FigureBase.add_subplot用法及代碼示例
- Python matplotlib Figure.savefig用法及代碼示例
- Python matplotlib Figure.colorbar用法及代碼示例
- Python matplotlib Figure.add_gridspec用法及代碼示例
- Python matplotlib Figure.sticky_edges用法及代碼示例
- Python matplotlib FigureBase.colorbar用法及代碼示例
- Python matplotlib FigureCanvasBase.new_timer用法及代碼示例
- Python matplotlib Figure.subplots用法及代碼示例
- Python matplotlib Figure.align_ylabels用法及代碼示例
- Python matplotlib Figure.align_xlabels用法及代碼示例
- Python matplotlib FigureBase.add_gridspec用法及代碼示例
- Python matplotlib FontManager用法及代碼示例
注:本文由純淨天空篩選整理自skytowner.com大神的英文原創作品 matplotlib.sphinxext.figmpl_directive.FigureMpl。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。