gpt4 book ai didi

python - 多边形图

转载 作者:行者123 更新时间:2023-11-30 21:53:42 25 4
gpt4 key购买 nike

我之前曾尝试解决 question需要使用 matplotlib 生成如下所示的图像。

required figure

为此,我编写了代码,虽然还可以,但被卡住了。但我在打印圆的各个部分时遇到了问题。

这是my code .

问题就在这些行

#Drawing those segments
plt.plot([14.0, 50.0],[ 50.0,86.0 ], color="black")
plt.plot([24.544155877284282, 24.54415587728429],[14.0, 50.0], color="black")
plt.plot([75.4558441227157, 24.544155877284282],[24.544155877284282, 24.54415587728429], color="black")
plt.plot([83.25966317040633, 63.77660356514324],[75.4558441227157, 24.544155877284282] , color="black")
plt.plot([50.0,86.0], [83.25966317040633, 63.77660356514324], color="black")

我得到了这个作为输出

output .

最佳答案

看起来您将值分组为错误的对 - 例如

[x1, y1], [x2, y2]

但应该是

[x1, x2], [y1, y2]
<小时/>
plt.plot([14.0, 50.0],[ 50.0,86.0 ], color="black")

#plt.plot([24.544155877284282, 24.54415587728429],[14.0, 50.0], color="red")
plt.plot([24.544155877284282, 14.0],[24.54415587728429, 50.0], color="red")

plt.plot([75.4558441227157, 24.544155877284282],[24.544155877284282, 24.54415587728429], color="blue")

#plt.plot([83.25966317040633, 63.77660356514324],[75.4558441227157, 24.544155877284282] , color="green")
plt.plot([83.25966317040633, 75.4558441227157],[63.77660356514324, 24.544155877284282] , color="green")

#plt.plot([50.0, 86.0], [ 83.25966317040633, 63.77660356514324], color="yellow")
plt.plot([50.0, 83.25966317040633], [86.0, 63.77660356514324], color="yellow")

enter image description here

关于python - 多边形图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59573711/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com