成功解决matplotlib.units.ConversionError: Failed to convert value(s) to axis units: ‘LiR‘

简介: 成功解决matplotlib.units.ConversionError: Failed to convert value(s) to axis units: ‘LiR‘


目录

解决问题

解决思路

解决方法


解决问题

1. 
2. No handles with labels found to put in legend.
3. 
4. Traceback (most recent call last):
5.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 508, in _draw_idle
6.     self.draw()
7.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py", line 388, in draw
8.     self.figure.draw(self.renderer)
9.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
10. return draw(artist, renderer, *args, **kwargs)
11.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py", line 1709, in draw
12.     renderer, self, artists, self.suppressComposite)
13.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\image.py", line 135, in _draw_list_compositing_images
14.     a.draw(renderer)
15.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
16. return draw(artist, renderer, *args, **kwargs)
17.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes\_base.py", line 2647, in draw
18.     mimage._draw_list_compositing_images(renderer, self, artists)
19.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\image.py", line 135, in _draw_list_compositing_images
20.     a.draw(renderer)
21.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
22. return draw(artist, renderer, *args, **kwargs)
23.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py", line 670, in draw
24.     bbox, info, descent = textobj._get_layout(renderer)
25.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py", line 276, in _get_layout
26.     key = self.get_prop_tup(renderer=renderer)
27.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py", line 831, in get_prop_tup
28.     x, y = self.get_unitless_position()
29.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py", line 813, in get_unitless_position
30.     x = float(self.convert_xunits(self._x))
31.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 180, in convert_xunits
32. return ax.xaxis.convert_units(x)
33.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 1553, in convert_units
34. f'units: {x!r}') from e
35. matplotlib.units.ConversionError: Failed to convert value(s) to axis units: 'LiR'
36. Traceback (most recent call last):
37.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 1550, in convert_units
38.     ret = self.converter.convert(x, self.units, self)
39.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\category.py", line 52, in convert
40. 'Missing category information for StrCategoryConverter; '
41. ValueError: Missing category information for StrCategoryConverter; this might be caused by unintendedly mixing categorical and numeric data
42. The above exception was the direct cause of the following exception:
43. Traceback (most recent call last):
44.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 508, in _draw_idle
45.     self.draw()
46.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py", line 388, in draw
47.     self.figure.draw(self.renderer)
48.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
49. return draw(artist, renderer, *args, **kwargs)
50.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py", line 1709, in draw
51.     renderer, self, artists, self.suppressComposite)
52.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\image.py", line 135, in _draw_list_compositing_images
53.     a.draw(renderer)
54.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
55. return draw(artist, renderer, *args, **kwargs)
56.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes\_base.py", line 2647, in draw
57.     mimage._draw_list_compositing_images(renderer, self, artists)
58.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\image.py", line 135, in _draw_list_compositing_images
59.     a.draw(renderer)
60.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
61. return draw(artist, renderer, *args, **kwargs)
62.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py", line 670, in draw
63.     bbox, info, descent = textobj._get_layout(renderer)
64.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py", line 276, in _get_layout
65.     key = self.get_prop_tup(renderer=renderer)
66.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py", line 831, in get_prop_tup
67.     x, y = self.get_unitless_position()
68.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py", line 813, in get_unitless_position
69.     x = float(self.convert_xunits(self._x))
70.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 180, in convert_xunits
71. return ax.xaxis.convert_units(x)
72.   File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 1553, in convert_units
73. f'units: {x!r}') from e
74. matplotlib.units.ConversionError: Failed to convert value(s) to axis units: 'LiR'

解决思路

matplotlib.units.Conversion错误:未能将值转换为轴单元:'LiR'

解决方法

matplotlib版本较低,将matplotlib库,更新至3.3.2版本以上即可!

文章知识点与官方知识档案匹配,可进一步学习相关知识



相关文章
|
6月前
GEE错误——Layer error: Image.connectedPixelCount: Segment size calculation on floating point bands is n
GEE错误——Layer error: Image.connectedPixelCount: Segment size calculation on floating point bands is n
75 0
|
3月前
|
TensorFlow 算法框架/工具
【Tensorflow】解决A `Concatenate` layer should be called on a list of at least 2 inputs
在TensorFlow 2.0中,使用Concatenate函数时出现错误,可以通过替换为tf.concat 来解决。
40 4
|
3月前
|
PyTorch 算法框架/工具
【Pytorch】解决Fan in and fan out can not be computed for tensor with fewer than 2 dimensions
本文提供了两种解决PyTorch中由于torchtext版本问题导致的“Fan in and fan out can not be computed for tensor with fewer than 2 dimensions”错误的方法。
84 2
|
3月前
|
算法框架/工具
【Tensorflow+keras】解决Exception has occurred: ValueError Shape mismatch: The shape of labels (received
在使用Keras构建的图像分类模型训练过程中,因使用了sparse_categorical_crossentropy损失函数而导致标签形状与模型输出形状不匹配的错误,解决方法是更换损失函数为categorical_crossentropy。
58 0
Expected more than 1 value per channel when training, got input size torch.Size
因为模型中用了batchnomolization,训练中用batch训练的时候当前batch恰好只含一个sample,而由于BatchNorm操作需要多于一个数据计算平均值,因此造成该错误。
895 0
|
JSON 数据格式
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
513 0
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
|
TensorFlow 算法框架/工具
ValueError: Negative dimension size caused by subtracting 5 from 1 for ‘{{node le_net5/conv2d/Conv2D
ValueError: Negative dimension size caused by subtracting 5 from 1 for ‘{{node le_net5/conv2d/Conv2D
174 0
成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be
成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be
成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be
|
数据可视化 Linux Python
成功解决RuntimeError: Selected KDE bandwidth is 0. Cannot estiamte density
成功解决RuntimeError: Selected KDE bandwidth is 0. Cannot estiamte density
Can not squeeze dim[1], expected a dimension of 1, got 21
Can not squeeze dim[1], expected a dimension of 1, got 21
471 0
下一篇
无影云桌面