Plot 2D or 3D data. Parameters ---------- xs : 1D array-like x coordinates of vertices. ys : 1D array-like y coordinates of vertices. zs : float or 1D array-like z coordinates of vertices; either one for all points
(self, xs, ys, *args, zdir='z', axlim_clip=False, **kwargs)
| 2198 | text2D = Axes.text |
| 2199 | |
| 2200 | def plot(self, xs, ys, *args, zdir='z', axlim_clip=False, **kwargs): |
| 2201 | """ |
| 2202 | Plot 2D or 3D data. |
| 2203 | |
| 2204 | Parameters |
| 2205 | ---------- |
| 2206 | xs : 1D array-like |
| 2207 | x coordinates of vertices. |
| 2208 | ys : 1D array-like |
| 2209 | y coordinates of vertices. |
| 2210 | zs : float or 1D array-like |
| 2211 | z coordinates of vertices; either one for all points or one for |
| 2212 | each point. |
| 2213 | zdir : {'x', 'y', 'z'}, default: 'z' |
| 2214 | When plotting 2D data, the direction to use as z. |
| 2215 | axlim_clip : bool, default: False |
| 2216 | Whether to hide data that is outside the axes view limits. |
| 2217 | |
| 2218 | .. versionadded:: 3.10 |
| 2219 | **kwargs |
| 2220 | Other arguments are forwarded to `matplotlib.axes.Axes.plot`. |
| 2221 | """ |
| 2222 | had_data = self.has_data() |
| 2223 | |
| 2224 | # `zs` can be passed positionally or as keyword; checking whether |
| 2225 | # args[0] is a string matches the behavior of 2D `plot` (via |
| 2226 | # `_process_plot_var_args`). |
| 2227 | if args and not isinstance(args[0], str): |
| 2228 | zs, *args = args |
| 2229 | if 'zs' in kwargs: |
| 2230 | raise TypeError("plot() for multiple values for argument 'zs'") |
| 2231 | else: |
| 2232 | zs = kwargs.pop('zs', 0) |
| 2233 | |
| 2234 | xs, ys, zs = cbook._broadcast_with_masks(xs, ys, zs) |
| 2235 | |
| 2236 | lines = super().plot(xs, ys, *args, **kwargs) |
| 2237 | for line in lines: |
| 2238 | art3d.line_2d_to_3d(line, zs=zs, zdir=zdir, axlim_clip=axlim_clip) |
| 2239 | |
| 2240 | xs, ys, zs = art3d.juggle_axes(xs, ys, zs, zdir) |
| 2241 | self.auto_scale_xyz(xs, ys, zs, had_data) |
| 2242 | return lines |
| 2243 | |
| 2244 | plot3D = plot |
| 2245 |