如何在 matplot python 中绘制单个点 [英] How can I plot a single point in matplot python
本文介绍了如何在 matplot python 中绘制单个点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在我的图表上绘制一个点但似乎它们都需要按照列表或方程式进行绘制.
I'd like to plot a single point on my graph but it seems like they all need to plot as either a list or equation.
我需要像ax.plot(x,y)一样进行绘制,并且点将出现在我的图的x,y坐标上.
I need to plot like ax.plot(x, y) and a dot will be appeared at my x, y coordinates on my graph.
这是我的代码
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
import numpy
fig = plt.figure()
plt.xlabel('Width')
plt.ylabel('Height')
ax = fig.gca()
ax.set_xticks(numpy.arange(0,grid[0] + 20,20))
ax.set_yticks(numpy.arange(0,grid[1] + 20,20))
ax.plot(105, 200)
plt.grid()
plt.show()
推荐答案
这对我有用:
plt.plot(105,200,'ro')
这篇关于如何在 matplot python 中绘制单个点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文