原文链接:http://www.juzicode.com/archives/2486

错误提示:

使用matplotlib legend提示:ValueError: Unrecognized location ‘upper’. Valid locations are

Traceback (most recent call last):File "09-plt-step.py", line 30, in <module>plt.legend(title='参数where:',fontsize='xx-small',loc='upper')File "D:\Python\Python38\lib\site-packages\matplotlib\pyplot.py", line 2738, in legendreturn gca().legend(*args, **kwargs)File "D:\Python\Python38\lib\site-packages\matplotlib\axes\_axes.py", line 417, in legendself.legend_ = mlegend.Legend(self, handles, labels, **kwargs)File "D:\Python\Python38\lib\site-packages\matplotlib\legend.py", line 455, in __init__raise ValueError(
ValueError: Unrecognized location 'upper'. Valid locations arebestupper rightupper leftlower leftlower rightrightcenter leftcenter rightlower centerupper centercenter

可能原因:

1、使用matplotlib的legend图例说明是,说明位置参数loc=’upper’非法,没有’upper’类型的位置值

解决方法:

1、通过错误提示找到合法的位置值,可以使用下面这些字符串表示的位置,比如upper right表示右上角:

        bestupper rightupper leftlower leftlower rightrightcenter leftcenter rightlower centerupper centercenter

Python错误集锦:matplotlib legend提示:ValueError: Unrecognized location ‘upper’. Valid locations are相关推荐

  1. Python错误集锦:python: can’t open file ‘hello’: [Errno 2] No such file or directory

    错误提示: 在命令行输入python py文件名称,提示:python: can't open file 'hello': [Errno 2] No such file or directory D: ...

  2. Python错误集锦:打开文件路径提示参数无效,OSError: [Errno 22] Invalid argument: ‘D:\juzicode\桔子code\readme.txt’

    原文链接:http://www.juzicode.com/archives/2493 错误提示: 打开文件路径提示参数无效:OSError: [Errno 22] Invalid argument: ...

  3. Python错误集锦:pandas读取excel提示ImportError: Missing optional dependency ‘xlrd’.

    原文链接:http://www.juzicode.com/archives/3125 错误提示: 用pandas read_excel()方法读取xls或xlsx文件时,提示:ImportError: ...

  4. Python错误集锦:pandas绘制多个子图时报错:AttributeError: ‘list’ object has no attribute ‘get_figure’

    原文链接:http://www.juzicode.com/archives/3273 错误提示: 利用pandas绘制多个子图时报错:AttributeError: 'list' object has ...

  5. Python花式错误集锦

    width="330" height="86" src="//music.163.com/outchain/player?type=3&id= ...

  6. Python可视化(matplotlib)图像自定义图例(Legend)

    Python可视化(matplotlib)图像自定义图例(Legend) 目录 Python可视化(matplotlib)图像自定义图例(Legend) 简单图例

  7. python plt legend并排,matplotlib Legend 图例用法

    matplotLib Legend添加图例:展示数据的信息 用法: legend(): 默认获取各组数据的Label并展示在图框左上角 legend(labels): legend(handles, ...

  8. python 错误与异常

    python 错误与异常 语法错误 异常:大多数的异常都不会被程序处理,都以错误信息的形式展现在这里 异常处理: while True:try:x = int(input("请输入一个错误: ...

  9. 在Hadoop 2.3上运行C++程序各种疑难杂症(Hadoop Pipes选择、错误集锦、Hadoop2.3编译等)

    首记 感觉Hadoop是一个坑,打着大数据最佳解决方案的旗帜到处坑害良民.记得以前看过一篇文章,说1TB以下的数据就不要用Hadoop了,体现不出太大的优势,有时候反而会成为累赘.因此Hadoop的使 ...

最新文章

  1. Android_CodeWiki_01
  2. SQL Server 2008 安装问题
  3. SVM熟练到精通2:SVM目标函数的dual优化推导
  4. Redis Monitor命令 - 实时打印出Redis服务器接收到的命令,调试用
  5. HDU 4535 吉哥系列故事——礼尚往来
  6. python中doc=parased.getroot()_python中执行sed命令操作源文件时出现错误
  7. 开学季,复旦老师教你玩转“0”“1”浪漫!| 人物志
  8. 使用WCF实现消息推送
  9. 计算机声音控制程序,win10电脑利用EarTrumpet音量控制应用程序使用教程 | 专业网吧维护...
  10. 台式计算机睡眠快捷键,电脑如何设置快捷方式迅速进入睡眠的状态?
  11. 计算机网络技术人员素质要求,做网络技术员需要学习哪些技能
  12. 腾讯云服务器放音乐,使用腾讯云函数实现网易云音乐自动打卡签到
  13. 成都市绿色建筑创建行动实施计划通知
  14. Purdue, Mathematics Area Examination 学习笔记(1)
  15. 关于汽车悬挂系统减震控制的进一步研究(自动控制原理课程设计小论文)
  16. 作为 Gopher, 你知道 Go 的注释即文档应该怎么写吗
  17. 《大话处理器》相关主题汇总
  18. TDChat国内ChatGPT镜像网站最新网站入口地址
  19. C语言_公倍数、最小公倍数_调用函数求最大公因数最小公倍数
  20. 3D建模布线需要注意哪些?

热门文章

  1. 海康威视DS-2DC2402IW-D3/W 安装使用教程
  2. 华为云物联网平台的微信小程序开发
  3. C#中ManualResetEvent用法
  4. Eclipse插件版本
  5. runauto.. 病毒斗争记
  6. sort()排序函数
  7. 第一次找工作/实习前需要准备的东西(互联网行业)
  8. 三大世界级难题,等你来解答
  9. 硕士生论文存在的问题
  10. 政策重大升级、成立最强行业联盟,上海要做长三角区块链产业发展领头羊?...