使用matplotlib构建网络图时出错 [英] Error while building a network graph using matplotlib

查看:185
本文介绍了使用matplotlib构建网络图时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文件

matplotlib.rcParams ['figure.figsize'] =(50,50)

matplotlib.rcParams['figure.figsize'] = (50, 50)

NameError:未定义名称"matplotlib"

NameError: name 'matplotlib' is not defined

我已经导入了matplotlib.pyplot但仍然得到了这个?可能是什么原因?

I have imported matplotlib.pyplot but still getting this? what could be the reason?

推荐答案

尝试一下:

import matplotlib as mpl
mpl.rcParams['figure.figsize'] = (50, 50)

来自matplotlib 文档.

From matplotlib docs.

您要从matplotlib(matplotlib的一部分)导入pyplot框架,只有在执行上述作为mpl的导入后,您才能访问完整的matplotlib库.现在,您可以使用mpl别名访问rcParams.

You are importing pyplot framework from matplotlib(a part of matplotlib), you don't have access to the full matplotlib library until you do the above import as mpl. Now, you can use mpl alias to access rcParams.

这篇关于使用matplotlib构建网络图时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆