【发布时间】:2021-09-07 19:23:59
【问题描述】:
我想在图例上打印列表名称而不是打印列表。任何的想法? 代码如下:
import numpy as np
m = [x,y]
fig = plt.figure()
ax = plt.subplot(111)
#j = ["1","1","1","1","1"]
for i in m:
ax.plot(i, label='$variable = %s$'%i)
# Shrink current axis by 20%
box = ax.get_position()
ax.set_position([box.x0, box.y0, box.width * 0.8, box.height])
# Put a legend to the right of the current axis
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.show()
在图例中我想要变量 = x 和变量 = y
【问题讨论】:
标签: python python-3.x matplotlib