python - 缩短 Matplotlib 图中的线段

标签 python matplotlib

是否可以缩短 matplotlib 图中的线段以生成如下图所示的图像,其中线段未完全到达点标记?

Plot with shortened edges

最佳答案

我发现了以下愚蠢的方法,但对我来说它有效

import matplotlib.pyplot as plt

x = [0, 1, 2, 3, 4, 5]
y = [1, 3, 2, 5, 3, 1]
plt.figure()
plt.plot(x,y,'b-')
plt.plot(x,y,'wo', markersize=25, markeredgecolor = 'w')
plt.plot(x,y,'bo', markersize=7, markeredgecolor = 'w')
plt.show()

关于python - 缩短 Matplotlib 图中的线段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15606613/

相关文章:

python - QMainWindow关闭时如何关闭QDialog

python - 为图形图例创建一个双色矩形的 matplotlib mpatches

python - matplotlib 轴刻度标签 : getting mantissa and exponent

python - 求解线性系统的 sympy 问题

python - 导入 StanfordNER Tagger Google Colab

python - 在 ipython 图形窗口中放大后,Matplotlib 轴刻度格式发生变化

python - 在 matplotlib 图中使用多种颜色

python - 我怎样才能绘制ca。 2000 万个点作为散点图?

python - UnrecognizedImageError - 图像插入错误 - python-docx

python - 如何捕获在python中运行的vba代码中的异常