溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

python畫圖模塊plotnine怎么安裝

發(fā)布時間:2021-11-26 10:00:29 來源:億速云 閱讀:953 作者:iii 欄目:大數(shù)據(jù)

本篇內(nèi)容主要講解“python畫圖模塊plotnine怎么安裝”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“python畫圖模塊plotnine怎么安裝”吧!

安裝

按照官網(wǎng)教程直接使用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命令后加參數(shù)--ignore-installed certifi

于是使用命令安裝

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

這次安裝成功沒有報錯

python中嘗試導(dǎo)入這個模塊

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
 

搜索了一番,發(fā)現(xiàn)有人說可以卸載已經(jīng)安裝的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然后再導(dǎo)入plotnine模塊

from plotnine import *
 

這次沒有任何提示了

接下來試著運(yùn)行其中的一個例子

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怎么安裝”有了更深的了解,不妨來實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI