如何在 matplot python 中绘制单个点

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28504737/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 03:20:21  来源:igfitidea点击:

How can I plot a single point in matplot python

pythonmatplotlib

提问by Xrypto

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.

我想在我的图表上绘制一个点,但似乎它们都需要绘制为列表或方程。

I need to plot like ax.plot(x, y) and a dot will be appeared at my x, y coordinates on my graph.

我需要像 ax.plot(x, y) 一样绘图,并且我的图形上的 x, y 坐标处会出现一个点。

here is my code

这是我的代码

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()

回答by scottlittle

This worked for me:

这对我有用:

plt.plot(105,200,'ro')