GrigoriiTarasov

KeyError: 'PolyCollection:kwdoc' during pyplot import

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