python字符串与浮点数作图

要使用Python绘制字符串和浮点数,你可以使用Python的Matplotlib库。下面是一个简单的示例代码,用于绘制包含字符串和浮点数的图形:

import matplotlib.pyplot as plt

x = [1, 2, 3, 4, 5]
y1 = [1.0, 2.0, 3.0, 4.0, 5.0]
y2 = [2.0, 4.0, 6.0, 8.0, 10.0]
labels = ['one', 'two', 'three', 'four', 'five']

fig, ax = plt.subplots()
ax.plot(x, y1, label='line 1')