【发布时间】:2022-01-02 14:36:29
【问题描述】:
考虑下面的代码和从中得到的图形
import matplotlib.pyplot as plt
import numpy as np
fig,axs = plt.subplots(figsize=(10,10))
data1 = [5, 6, 18, 7, 19]
x_ax = [10, 20, 30, 40, 50]
y_ax = [0, 5, 10, 15, 20]
axs.plot(data1,marker="o")
axs.set_xticks(x_ax)
axs.set_xticklabels(labels=x_ax,rotation=45)
axs.set_yticks(y_ax)
axs.set_yticklabels(labels=y_ax,rotation=45)
axs.set_xlabel("X")
axs.set_ylabel("Y")
axs.set_title("Name")
我需要以10 的步长绘制我的data1 = [5, 6, 18, 7, 19]。 5 代表 10,6 代表 20,18 代表 30,7 代表 40 和 19 代表 50。但情节的步长为 1。
如何修改我的代码以执行所需的操作?
【问题讨论】:
标签: matplotlib graph