code: def set_legend(axis, lines, legend):
      
      try:
          if legend:
              axis.legend(lines, legend)
      except Exception as e:
          raise ValueError("invalid 'legend', Error: %s" % e)
docs: Set line legend.
  
      **中文文档**
  
      设置图例。