.add_patch()基本文件问题
在我编写的代码中,.add_patch()给出错误。过去5天一直试图解决这个问题,但不能这样做。 当我单独将其用于椭圆形而不是将其与另一个椭圆相结合时,也可以使用相同的呼叫。 请看一下!
# Importing Necessary Libraries
import pandas as pd
import numpy as np
import random as rd
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.style as stl
xys = [[10,125],[100,26],[25,66],[67,1],[74,10]]
xys=np.array(xys)
mean = np.mean(xys,0)
stdDev = np.std(xys,0)
ellipse = patches.Ellipse(mean[0],mean[1],stdDev[0]*2,stdDev[1]*2)
fig, graph=plt.subplots()
graph.scatter(xys[:,0],xys[:,1])
graph.scatter(mean[0],mean[1])
graph.add_patch(ellipse)
In the code I wrote, .add_patch() is giving error. Have been trying to figure this out for past 5 days but couldn't do so.
The same call is working when I use it separately for just an ellipse instead of combining it with another one.
Kindly look into this!!
# Importing Necessary Libraries
import pandas as pd
import numpy as np
import random as rd
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.style as stl
xys = [[10,125],[100,26],[25,66],[67,1],[74,10]]
xys=np.array(xys)
mean = np.mean(xys,0)
stdDev = np.std(xys,0)
ellipse = patches.Ellipse(mean[0],mean[1],stdDev[0]*2,stdDev[1]*2)
fig, graph=plt.subplots()
graph.scatter(xys[:,0],xys[:,1])
graph.scatter(mean[0],mean[1])
graph.add_patch(ellipse)
This is the result I am getting on the terminal when I am running the file
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看
所以是:
Look at the documentation for
patches.Ellipse
So this is: