python - 在python中的点之间绘制网格线
问题描述
我在(x,y)
飞机上有 6 个点:x=[x1,x2,x3,x4,x5,x6]
和y=[y1,y2,y3,y4,y5,y6]
import matplotlib.pyplot as plt
x = [0, 2, 4, 0, 2, 4, 0, 2, 4]
y = [0, 0, 0, 3, 3, 3, 7, 7, 7]
plt.scatter(x, y)
plt.show()
我想在两点之间,在每个轴上绘制完全平行的线x,y
(如photo)。以及如何在图表上隐藏 x 和 y 轴。我想绘制 3 层建筑的梁柱的 2D 视图;确实matplotlib
让我达到了我的目标还是我应该去其他图书馆?
解决方案
绝对matplotlib
可以做到这一点。看看他们的Rectangle Patch:
示例用法(您必须根据需要对其进行修改):
import matplotlib.pyplot as plt
import matplotlib.patches as patches
fig = plt.figure()
ax = fig.add_subplot()
rect = patches.Rectangle(
(0.1, 0.1),
0.5,
0.5,
fill=False
)
ax.add_patch(rect)
fig.show()
推荐阅读
- php - 使用 Twilio 发送 SMS 后获取 SMS 的费用
- r - 将 .dat 文件读入 R
- r - 如何从 R 中的 geom_smooth 图中获取预测值?
- python - 类中的 Python 类
- z3 - 从 API 设置 Z3 详细程度
- jquery - Kendo UI Grid MVC dataSource.at(0) undefined with AutoBind = false and after dataSource.Read()
- reactjs - 应用程序不会运行 TypeError:无法读取未定义的属性“地图”
- javascript - 构建双重功能按钮
- javascript - JSON 没有通过 JQuery 传递给控制器
- xcode - SwiftUI 圆形按钮在单击时会变形