我对python很陌生,我想在python的图上画一个点。
X_cord=int(raw_input("Enter the x-coordinate"))
Y_cord=int(raw_input("Enter the y-coordinate"))我能想出这么多。
发布于 2015-08-30 15:15:37
看看matplotlib,一个用于Python的2D绘图库。对于您的代码,这可能有效:
import matplotlib.pyplot as plt # I include a module which contains the plotting functionality I need: https://docs.python.org/2/tutorial/modules.html
plt.plot(X_cord, # here go the X coordinates
Y_cord, # here go the Y coordinates
marker='x', # as I'm plotting only one point here, I'd like to make it extra visible
markersize=10 # by choosing a nice marker shape ('x') and large size
)
plt.show() # this shows the current plot in a pop-up window如果要立即将该数字保存为图像,还可以选择将最后一行替换为
plt.savefig("my_first_plot.pdf", bbox_inches='tight')
plt.close()编辑:我把它写得更详细了,但是主要的建议是更好地了解Python ( web上的大量教程,这里不是它的位置),如果您想了解更多关于绘图的知识,可以阅读matplotlib文档。希望这会有所帮助,或者随意发布你遇到的具体问题。
发布于 2018-07-16 19:15:59
python有不同的绘图库,如matplotlib、seaborn等。但使用最广泛的是matplotlib。
最好是检查和阅读他们的文件。
Matplotlib:
import matplotlib.pyplot as plt
x = [x_coordination]
y = [y_coordination]
plt.plot(x, y)海运:
import seaborn as sb
x = [x_coordination]
y = [y_coordination]
sb.pointplot(x, y)这些代码可以生成简单的图形,但是,为了显示图形,您应该在代码下面写这一行。
plt.show()这是在图上绘制点的最简单的方法。
有关更多细节,建议阅读文档。
例如:
plt.plot(x, y, marker="*", markersize=2, color="green")或
sb.pointplot(x, y, markers="*", color="r")发布于 2021-04-17 10:24:17
如果您正在寻找更简单的东西,您可以尝试https://quickchart.io/,它工作得很好。它生成一个URL,或者您可以保存一个图像。
您可以在这里看到一个关于天气数据的完整示例:https://pythonhowtoprogram.com/get-weather-forecasts-and-show-it-on-a-chart-using-python-3/
(完全公开,这是我的帖子!)

https://stackoverflow.com/questions/32297960
复制相似问题