跳转至

maliang.mpl

字数 11 个   阅读时间不到 1 分钟   访问量

源代码:maliang/mpl/__init__.py

Extension package of maliang for matplotlib

Provides:

  • Implemented an easy-to-use matplotlib interface to tkinter
  • Themed drawing experience
  • Good interaction with matplotlib plottings

模块:

类:

  • FigureCanvas

    A canvas for interface of matplotlib

  • FigureToolbar

    An interface class for the matplotlib navigation cursor

函数:

FigureCanvas

FigureCanvas(master: tkinter.Misc, figure: matplotlib.figure.Figure, *args, **kwargs)

Bases: tkinter.Canvas, matplotlib.backends.backend_tkagg.FigureCanvasTkAgg

A canvas for interface of matplotlib

  • master: parent widget
  • figure: a Figure object from matplotlib

方法:

  • theme

    Change the color theme of the Figure.

theme

theme(theme: typing.Literal['light', 'dark']) -> None

Change the color theme of the Figure.

  • theme: the theme name

FigureToolbar

FigureToolbar(
    master: tkinter.Misc | FigureCanvas,
    figure_canvas: FigureCanvas | None = None,
    *,
    pack_toolbar: bool = True,
    **kwargs
)

Bases: matplotlib.backends._backend_tk.NavigationToolbar2Tk

An interface class for the matplotlib navigation cursor

  • master: parent widget
  • figure_canvas: the figure canvas on which to operate
  • pack_toolbar: if True, add the toolbar to the parent’s pack manager’s packing list during initialization with side="bottom" and fill="x".

If you want to use the toolbar with a different layout manager, use pack_toolbar=False

方法:

  • theme

    Change the color theme of the Toolbar.

theme

theme(theme: typing.Literal['light', 'dark']) -> None

Change the color theme of the Toolbar.

  • theme: the theme name

set_mpl_default_theme

set_mpl_default_theme(theme: typing.Literal['light', 'dark'], *, apply_font: bool = False) -> None

Set default color constants of matplotlib.

  • theme: theme mode
  • apply_font: whether to use the font of maliang