python - 如何在文本框中包含绘图线型图例的图像
问题描述
当我们调用 时legend
,该框有一张小图片,显示线条样式/标记样式与我的绘图一起使用。我想获取该图像以进行绘图(实线和虚线的一小部分)并将它们包含在文本框中。
我得到的最接近的是以下内容:
stable, = ax.plot(np.arange(10),np.arange(10),linestyle='solid', linewidth=5,color='k')
unstable, = ax.plot(np.arange(10),np.arange(10),linestyle='dashed', linewidth=3, color='k')
ghost, = ax.plot(0,0) # just to make some space in the legend box
ax.legend([ghost,stable,unstable],['Some text','some text', 'some text',loc='lower left')
但是,对于我想要包含的文本,我认为使用单独的text
框并包含我在通常框中看到的“图像”会更容易,legend
因为我需要多次引用它。这个怎么做?
解决方案
推荐阅读
- django - Django 在发出 POST 请求时在表单集中有多个表单时抛出错误
- git - Git保持相同的提交但恢复文件
- javascript - 是否有一个 loadash 函数来比较两个数组并仅当 arr2 中的所有值都存在于 arr1 时才返回 true?
- swift - 为什么我必须放弃 Swift 类的协议一致性以进行数组扩展?
- node.js - 无法获取特定路线
- ios - Apple 商店要求 {mediaType: 'photo'} 中的音频权限
- excel - 一个单元格中的不同格式 - Excel Web
- javascript - 如何使用 gmail api 获取新消息
- javascript - cytoscape.js 在一个元素上的相同/不同事件类型上是否有稳定的事件排序?
- ckeditor - 当我尝试从 ckeditor 导入时“未找到此依赖项”