Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------------------------------------------------------
- ValueError Traceback (most recent call last)
- File ~/mambaforge/envs/boosting_mle/lib/python3.11/site-packages/matplotlib/_docstring.py:57, in _ArtistKwdocLoader.__missing__(self, key)
- 56 try:
- ---> 57 cls, = [cls for cls in _api.recursive_subclasses(Artist)
- 58 if cls.__name__ == name]
- 59 except ValueError as e:
- ValueError: too many values to unpack (expected 1)
- The above exception was the direct cause of the following exception:
- KeyError Traceback (most recent call last)
- Cell In[46], line 2
- 1 import sys
- ----> 2 import matplotlib.pyplot as plt
- 4 # Clear the cache for the imported module
- 5 sys.modules.pop('matplotlib.pyplot', None)
- File ~/mambaforge/envs/boosting_mle/lib/python3.11/site-packages/matplotlib/pyplot.py:66
- 63 from matplotlib import _docstring
- 64 from matplotlib.backend_bases import (
- 65 FigureCanvasBase, FigureManagerBase, MouseButton)
- ---> 66 from matplotlib.figure import Figure, FigureBase, figaspect
- 67 from matplotlib.gridspec import GridSpec, SubplotSpec
- 68 from matplotlib import rcsetup, rcParamsDefault, rcParamsOrig
- File ~/mambaforge/envs/boosting_mle/lib/python3.11/site-packages/matplotlib/figure.py:43
- 40 import numpy as np
- 42 import matplotlib as mpl
- ---> 43 from matplotlib import _blocking_input, backend_bases, _docstring, projections
- 44 from matplotlib.artist import (
- 45 Artist, allow_rasterization, _finalize_rasterization)
- 46 from matplotlib.backend_bases import (
- 47 DrawEvent, FigureCanvasBase, NonGuiException, MouseButton, _get_renderer)
- File ~/mambaforge/envs/boosting_mle/lib/python3.11/site-packages/matplotlib/projections/__init__.py:55
- 1 """
- 2 Non-separable transforms that map from data space to screen space.
- 3
- (...)
- 52 `matplotlib.projections.polar` may also be of interest.
- 53 """
- ---> 55 from .. import axes, _docstring
- 56 from .geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
- 57 from .polar import PolarAxes
- File ~/mambaforge/envs/boosting_mle/lib/python3.11/site-packages/matplotlib/axes/__init__.py:2
- 1 from . import _base
- ----> 2 from ._axes import *
- 4 # Backcompat.
- 5 from ._axes import Axes as Subplot
- File ~/mambaforge/envs/boosting_mle/lib/python3.11/site-packages/matplotlib/axes/_axes.py:24
- 22 import matplotlib.patches as mpatches
- 23 import matplotlib.path as mpath
- ---> 24 import matplotlib.quiver as mquiver
- 25 import matplotlib.stackplot as mstack
- 26 import matplotlib.streamplot as mstream
- File ~/mambaforge/envs/boosting_mle/lib/python3.11/site-packages/matplotlib/quiver.py:30
- 26 import matplotlib.text as mtext
- 27 import matplotlib.transforms as transforms
- ---> 30 _quiver_doc = """
- 31 Plot a 2D field of arrows.
- 32
- 33 Call signature::
- 34
- 35 quiver([X, Y], U, V, [C], **kwargs)
- 36
- 37 *X*, *Y* define the arrow locations, *U*, *V* define the arrow directions, and
- 38 *C* optionally sets the color.
- 39
- 40 **Arrow length**
- 41
- 42 The default settings auto-scales the length of the arrows to a reasonable size.
- 43 To change this behavior see the *scale* and *scale_units* parameters.
- 44
- 45 **Arrow shape**
- 46
- 47 The arrow shape is determined by *width*, *headwidth*, *headlength* and
- 48 *headaxislength*. See the notes below.
- 49
- 50 **Arrow styling**
- 51
- 52 Each arrow is internally represented by a filled polygon with a default edge
- 53 linewidth of 0. As a result, an arrow is rather a filled area, not a line with
- 54 a head, and `.PolyCollection` properties like *linewidth*, *edgecolor*,
- 55 *facecolor*, etc. act accordingly.
- 56
- 57
- 58 Parameters
- 59 ----------
- 60 X, Y : 1D or 2D array-like, optional
- 61 The x and y coordinates of the arrow locations.
- 62
- 63 If not given, they will be generated as a uniform integer meshgrid based
- 64 on the dimensions of *U* and *V*.
- 65
- 66 If *X* and *Y* are 1D but *U*, *V* are 2D, *X*, *Y* are expanded to 2D
- 67 using ``X, Y = np.meshgrid(X, Y)``. In this case ``len(X)`` and ``len(Y)``
- 68 must match the column and row dimensions of *U* and *V*.
- 69
- 70 U, V : 1D or 2D array-like
- 71 The x and y direction components of the arrow vectors. The interpretation
- 72 of these components (in data or in screen space) depends on *angles*.
- 73
- 74 *U* and *V* must have the same number of elements, matching the number of
- 75 arrow locations in *X*, *Y*. *U* and *V* may be masked. Locations masked
- 76 in any of *U*, *V*, and *C* will not be drawn.
- 77
- 78 C : 1D or 2D array-like, optional
- 79 Numeric data that defines the arrow colors by colormapping via *norm* and
- 80 *cmap*.
- 81
- 82 This does not support explicit colors. If you want to set colors directly,
- 83 use *color* instead. The size of *C* must match the number of arrow
- 84 locations.
- 85
- 86 angles : {'uv', 'xy'} or array-like, default: 'uv'
- 87 Method for determining the angle of the arrows.
- 88
- 89 - 'uv': Arrow direction in screen coordinates. Use this if the arrows
- 90 symbolize a quantity that is not based on *X*, *Y* data coordinates.
- 91
- 92 If *U* == *V* the orientation of the arrow on the plot is 45 degrees
- 93 counter-clockwise from the horizontal axis (positive to the right).
- 94
- 95 - 'xy': Arrow direction in data coordinates, i.e. the arrows point from
- 96 (x, y) to (x+u, y+v). Use this e.g. for plotting a gradient field.
- 97
- 98 - Arbitrary angles may be specified explicitly as an array of values
- 99 in degrees, counter-clockwise from the horizontal axis.
- 100
- 101 In this case *U*, *V* is only used to determine the length of the
- 102 arrows.
- 103
- 104 Note: inverting a data axis will correspondingly invert the
- 105 arrows only with ``angles='xy'``.
- 106
- 107 pivot : {'tail', 'mid', 'middle', 'tip'}, default: 'tail'
- 108 The part of the arrow that is anchored to the *X*, *Y* grid. The arrow
- 109 rotates about this point.
- 110
- 111 'mid' is a synonym for 'middle'.
- 112
- 113 scale : float, optional
- 114 Scales the length of the arrow inversely.
- 115
- 116 Number of data units per arrow length unit, e.g., m/s per plot width; a
- 117 smaller scale parameter makes the arrow longer. Default is *None*.
- 118
- 119 If *None*, a simple autoscaling algorithm is used, based on the average
- 120 vector length and the number of vectors. The arrow length unit is given by
- 121 the *scale_units* parameter.
- 122
- 123 scale_units : {'width', 'height', 'dots', 'inches', 'x', 'y', 'xy'}, optional
- 124 If the *scale* kwarg is *None*, the arrow length unit. Default is *None*.
- 125
- 126 e.g. *scale_units* is 'inches', *scale* is 2.0, and ``(u, v) = (1, 0)``,
- 127 then the vector will be 0.5 inches long.
- 128
- 129 If *scale_units* is 'width' or 'height', then the vector will be half the
- 130 width/height of the axes.
- 131
- 132 If *scale_units* is 'x' then the vector will be 0.5 x-axis
- 133 units. To plot vectors in the x-y plane, with u and v having
- 134 the same units as x and y, use
- 135 ``angles='xy', scale_units='xy', scale=1``.
- 136
- 137 units : {'width', 'height', 'dots', 'inches', 'x', 'y', 'xy'}, default: 'width'
- 138 Affects the arrow size (except for the length). In particular, the shaft
- 139 *width* is measured in multiples of this unit.
- 140
- 141 Supported values are:
- 142
- 143 - 'width', 'height': The width or height of the Axes.
- 144 - 'dots', 'inches': Pixels or inches based on the figure dpi.
- 145 - 'x', 'y', 'xy': *X*, *Y* or :math:`\\sqrt{X^2 + Y^2}` in data units.
- 146
- 147 The following table summarizes how these values affect the visible arrow
- 148 size under zooming and figure size changes:
- 149
- 150 ================= ================= ==================
- 151 units zoom figure size change
- 152 ================= ================= ==================
- 153 'x', 'y', 'xy' arrow size scales —
- 154 'width', 'height' — arrow size scales
- 155 'dots', 'inches' — —
- 156 ================= ================= ==================
- 157
- 158 width : float, optional
- 159 Shaft width in arrow units. All head parameters are relative to *width*.
- 160
- 161 The default depends on choice of *units* above, and number of vectors;
- 162 a typical starting value is about 0.005 times the width of the plot.
- 163
- 164 headwidth : float, default: 3
- 165 Head width as multiple of shaft *width*. See the notes below.
- 166
- 167 headlength : float, default: 5
- 168 Head length as multiple of shaft *width*. See the notes below.
- 169
- 170 headaxislength : float, default: 4.5
- 171 Head length at shaft intersection as multiple of shaft *width*.
- 172 See the notes below.
- 173
- 174 minshaft : float, default: 1
- 175 Length below which arrow scales, in units of head length. Do not
- 176 set this to less than 1, or small arrows will look terrible!
- 177
- 178 minlength : float, default: 1
- 179 Minimum length as a multiple of shaft width; if an arrow length
- 180 is less than this, plot a dot (hexagon) of this diameter instead.
- 181
- 182 color : color or color sequence, optional
- 183 Explicit color(s) for the arrows. If *C* has been set, *color* has no
- 184 effect.
- 185
- 186 This is a synonym for the `.PolyCollection` *facecolor* parameter.
- 187
- 188 Other Parameters
- 189 ----------------
- 190 data : indexable object, optional
- 191 DATA_PARAMETER_PLACEHOLDER
- 192
- 193 **kwargs : `~matplotlib.collections.PolyCollection` properties, optional
- 194 All other keyword arguments are passed on to `.PolyCollection`:
- 195
- 196 %(PolyCollection:kwdoc)s
- 197
- 198 Returns
- 199 -------
- 200 `~matplotlib.quiver.Quiver`
- 201
- 202 See Also
- 203 --------
- 204 .Axes.quiverkey : Add a key to a quiver plot.
- 205
- 206 Notes
- 207 -----
- 208
- 209 **Arrow shape**
- 210
- 211 The arrow is drawn as a polygon using the nodes as shown below. The values
- 212 *headwidth*, *headlength*, and *headaxislength* are in units of *width*.
- 213
- 214 .. image:: /_static/quiver_sizes.svg
- 215 :width: 500px
- 216
- 217 The defaults give a slightly swept-back arrow. Here are some guidelines how to
- 218 get other head shapes:
- 219
- 220 - To make the head a triangle, make *headaxislength* the same as *headlength*.
- 221 - To make the arrow more pointed, reduce *headwidth* or increase *headlength*
- 222 and *headaxislength*.
- 223 - To make the head smaller relative to the shaft, scale down all the head
- 224 parameters proportionally.
- 225 - To remove the head completely, set all *head* parameters to 0.
- 226 - To get a diamond-shaped head, make *headaxislength* larger than *headlength*.
- 227 - Warning: For *headaxislength* < (*headlength* / *headwidth*), the "headaxis"
- 228 nodes (i.e. the ones connecting the head with the shaft) will protrude out
- 229 of the head in forward direction so that the arrow head looks broken.
- 230 """ % _docstring.interpd.params
- 232 _docstring.interpd.update(quiver_doc=_quiver_doc)
- 235 class QuiverKey(martist.Artist):
- File ~/mambaforge/envs/boosting_mle/lib/python3.11/site-packages/matplotlib/_docstring.py:60, in _ArtistKwdocLoader.__missing__(self, key)
- 57 cls, = [cls for cls in _api.recursive_subclasses(Artist)
- 58 if cls.__name__ == name]
- 59 except ValueError as e:
- ---> 60 raise KeyError(key) from e
- 61 return self.setdefault(key, kwdoc(cls))
- KeyError: 'PolyCollection:kwdoc'
Advertisement
Add Comment
Please, Sign In to add comment