@@ -101,34 +101,12 @@ Here is a detailed description of the configuration methods:
101101 use a different backend. Therefore, you should avoid explicitly calling
102102 `~matplotlib.use ` unless absolutely necessary.
103103
104- .. _wsl-backends :
105-
106- Using Matplotlib with WSL
107- ^^^^^^^^^^^^^^^^^^^^^^^^^
108-
109- WSL2 distributions can display Linux GUI applications through WSLg. When
110- WSLg is available, it provides the display environment variables that GUI
111- toolkits use, so Matplotlib can select an interactive backend in the same way
112- as it does on other Linux systems. You do not need to install or configure
113- an X server separately.
114-
115- Make sure that a GUI toolkit supported by Matplotlib (for example, Qt or
116- Tk) is installed in the WSL environment. If Matplotlib cannot find a usable
117- interactive backend, check that WSLg is running and that ``DISPLAY `` or
118- ``WAYLAND_DISPLAY `` is set in the shell where Python is started. You can
119- inspect the selected backend with:
120-
121- .. code-block :: python3
122-
123- import matplotlib
124-
125- print(matplotlib.get_backend())
126-
127- If no display is available (for example, when running a script in a headless
128- WSL environment), select the non-interactive ``Agg `` backend and save figures
129- to files instead. See :ref: `the-builtin-backends ` for the available
130- interactive backends and :ref: `selecting-a-backend ` for ways to configure a
131- backend explicitly.
104+ .. note ::
105+ On WSL2, WSLg should make interactive backends work without a separate
106+ X server when a supported GUI toolkit is installed. If it does not,
107+ check that WSLg is running and that ``DISPLAY `` or ``WAYLAND_DISPLAY `` is
108+ defined. For headless WSL sessions, use the non-interactive ``Agg ``
109+ backend. See :ref: `the-builtin-backends ` and :ref: `selecting-a-backend `.
132110
133111.. _the-builtin-backends :
134112
0 commit comments