import matplotlib.pyplot as plt
import numpy as np
ydata = [55,60,65,70,75,80]
xdata = [1,2,3,4,5,6]
plt.plot(xdata, ydata)
set(plt.gca,'XTickLabel',{'Jan','Feb','Mar','April','May','June'})
plt.show()
我正在使用matplotlib并尝试添加文本值以显示在x轴上。matplotlib将字符串添加到轴
我曾尝试使用下面的代码,但得到以下错误消息
集(plt.gca,“XTickLabel”, {“一月”,“二月”,“三月”,“四月”,“可能”,‘六一’}) 类型错误:集预计最多1个参数,得到3我不知道这是什么 是指获取当前访问我已设置的值
[情节与自定义文本x轴点(的可能的复制https://stackoverflow.com/questions/3100985/plot -with-custom-text-for-x-axis-points) – davedwards