How can I plot a single point in matplot python

2020-08-09 06:15发布

问题:

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.

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

回答1:

This worked for me:

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