AttributeError: module 'matplotlib.pyplot' has no attribute 'Wedge'
时间: 2023-09-21 16:06:56 浏览: 67
This error occurs when the Wedge class is not found in the pyplot module of the matplotlib library.
To resolve this issue, you can try importing the Wedge class from the patches module of the matplotlib library. Here is an example:
```python
from matplotlib.patches import Wedge
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
wedge = Wedge((0, 0), 1, 0, 90)
ax.add_patch(wedge)
plt.show()
```
This code creates a simple pie chart with a Wedge patch. The Wedge class is imported from the patches module and then used to create a Wedge patch. The patch is then added to the plot using the add_patch method of the axis object. Finally, the plot is displayed using the show method of the pyplot module.
阅读全文