python-3.x - 如何将 python matplotlib.pyplot 图例标记更改为 1、2、3 之类的序列号,而不是形状或字符?
问题描述
import matplotlib.pyplot
plt.figure()
plt.plot(x, 'r+', label='one')
plt.plot(x1, 'go--', label ='two')
plt.plot(y, 'ro', label='Three')
plt.legend()
在上面的代码中,图例标记是 'r+' , 'go--' 和 'ro' 但我希望它变成 1,2 和 3,因为有 3 个图。?谁能帮我解决这个问题?还有什么方法可以在不对数字进行硬编码的情况下完成吗?“““ 谢谢。
解决方案
推荐阅读
- python-3.x - Pandas 根据值乘法生成行
- spring-webflux - spring-boot-starter-webflux 是否包含 spring-boot-starter-web?
- angular - 微前端,使用 Angular 框架作为外部
- java - 如何使用 EWS Java 在 ItemAttachment 中获取附件
- ocaml - OCaml 中是否有检测类型的通用打印机?
- javascript - Vue Axios 检索列表中对象的响应 ID
- javascript - 记忆一个咖喱函数
- javascript - 隐藏内容时使 div 跳转更平滑
- css - 如何覆盖两个相同宽度但不同高度的图像,一个固定,另一个滚动?
- mysql - 查询未显示预期输出