он строит две линии!Просто так происходит с этими осями, что они перекрываются!Если вы измените число в массивах, вы увидите.Я провел некоторое время, глядя на это, прежде чем я заметил, что происходит!Вот мой пример, который раскрыл это:
t = np.array([0,1,3])
data1 = np.array([5, 6,8])
data2 = np.array([2.5, 3.0,8])
fig, ax1 = plt.subplots()
my_xticks = ['March','April','May']

РЕДАКТИРОВАТЬ: Чтобы решить эту проблему без дополнительных точек данных, вам нужно установить ось Yценности.
import numpy as np
import matplotlib.pyplot as plt
t = np.array([0,1])
data1 = np.array([5, 6])
data2 = np.array([2.5, 3.0])
fig, ax1 = plt.subplots()
my_xticks = ['March','April','May']
color = 'tab:red'
ax1.set_xlabel('Month')
ax1.set_ylabel('Mio', color=color)
ax1.plot(t, data1, color=color)
ax1.tick_params(axis='y', labelcolor=color)
plt.ylim(0,8)#####here is the money maker
ax2 = ax1.twinx()
color = 'tab:blue'
ax2.set_ylabel('sin', color=color) # we already handled the x-label with ax1
ax2.plot(t, data2, color=color)
ax2.tick_params(axis='y', labelcolor=color,length=5)
plt.ylim(0,8)#####here is the money maker
fig.tight_layout() # otherwise the right y-label is slightly clipped
plt.xticks(t, my_xticks)
plt.show()
