python画图模块plotnine怎么安装

本篇内容主要讲解“python画图模块plotnine怎么安装”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“python画图模块plotnine怎么安装”吧!

创新互联是专业的东明网站建设公司,东明接单;提供网站设计、成都网站设计,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行东明网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!

安装

按照官网教程直接使用pip安装

pip install plotnine

遇到报错python画图模块plotnine怎么安装

ERROR: Cannot uninstall 'certifi'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

搜索一番找到说可以在pip命令后加参数--ignore-installed certifi

于是使用命令安装

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple plotnine --ignore-installed certifi
 

这次安装成功没有报错

python中尝试导入这个模块

from plotnine import *
 

提示

Bad key animation.mencoder_path in file C:\Users\mingy\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\mpl-data\stylelib\_classic_test.mplstyle, line 509 ('animation.mencoder_path: mencoder')
You probably need to get an updated matplotlibrc file from
https://github.com/matplotlib/matplotlib/blob/v3.3.1/matplotlibrc.template
or from the matplotlib source distribution
 

搜索了一番,发现有人说可以卸载已经安装的matplotlib然后再重新安装试试 使用pip命令卸载

pip uninstall matplotlib
 

重新安装命令

python -m pip install -U matplotlib --prefer-binary -i https://pypi.tuna.tsinghua.edu.cn/simple
 

matplotlib升级到了3.3.1 没有遇到报错 打开python然后再导入plotnine模块

from plotnine import *
 

这次没有任何提示了

接下来试着运行其中的一个例子

from plotnine import *
from plotnine.data import mtcars
ggplot(mtcars,aes(x='wt',y='mpg',color='factor(gear)'))+geom_point()
 
python画图模块plotnine怎么安装
image.png
ggplot(mtcars,aes(x='wt',y='mpg',color='factor(gear)'))+geom_point()+facet_wrap('~gear',scales="free")
 
python画图模块plotnine怎么安装
image.png

保存为pdf文件

(ggplot(mtcars,aes(x='wt',y='mpg',color='factor(gear)'))+geom_point()+facet_wrap('~gear',scales="free")).save("Desktop/p1.pdf")

到此,相信大家对“python画图模块plotnine怎么安装”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

分享标题:python画图模块plotnine怎么安装
文章起源:https://www.cdcxhl.com/article28/pgpjcp.html

成都网站建设公司_创新互联,为您提供网站改版品牌网站设计ChatGPT营销型网站建设移动网站建设网站营销

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

网站托管运营