我是matplotlib的新手。我正在尝试绘制一个散点图,其中yscale设置为log。该图表未显示图中的任何数据:
显示以下警告:
是的,有人能帮帮我吗? 这是代码:UserWarning: Attempted to set non-positive ylimits for log-scale axis; invalid limits will be ignored. 'Attempted to set non-positive ylimits for log-scale axis
rawdata = np.genfromtxt("E:\data\Paper\lifetime paper\smoothed and unsmoothed data.csv"
,delimiter=",", unpack=True)
x = rawdata[0]
lifetime_91_unsmoothed = rawdata[1]
lifetime_91_smoothed = rawdata[2]
lifetime_20_unsmoothed = rawdata[3]
lifetime_20_smoothed = rawdata[4]
fig = plt.figure()
ax1 = plt.subplot(121)
# fig.subplots_adjust(wspace=0.3)
# fig.set_figwidth(7)
# # fig.set_figheight(12)
ax1.scatter(x,lifetime_91_unsmoothed,marker='s',facecolors='k',s=30,edgecolors='k',
alpha=0.6,label='Unsmoothed lifetime')
ax1.scatter(x,lifetime_91_smoothed,marker='o',facecolors='r',s=30,edgecolors='r',
alpha=0.6,label='Smoothed lifetime')
# ax1.scatter((0.5),(0.5),marker='o')
ax1.set_yscale('log')
ax1.set_xlim(0,1.01)
ax1.set_ylim(0,1.01)
ax1.set_xlabel('Time [s]',fontsize=12)
ax1.set_ylabel('Normalized intensity', fontsize=12)
ax1.legend(loc=0,frameon=False,fontsize=12)
ax1.tick_params(axis='both', labelsize=12)
plt.show()