日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python画图模块_学习python画图模块plotnine:第一步安装

發布時間:2023/12/10 python 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python画图模块_学习python画图模块plotnine:第一步安装 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

官網鏈接

https://plotnine.readthedocs.io/en/stable/index.html

知乎介紹的文章

https://zhuanlan.zhihu.com/p/47814353

簡單介紹

語法類似于R語言的ggplot2包的python畫圖模塊

安裝

按照官網教程直接使用pip安裝

pip?install?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()

image.png

ggplot(mtcars,aes(x='wt',y='mpg',color='factor(gear)'))+geom_point()+facet_wrap('~gear',scales="free")

image.png

保存為pdf文件

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

歡迎大家關注我的公眾號

小明的數據分析筆記本

公眾號二維碼.jpg

總結

以上是生活随笔為你收集整理的python画图模块_学习python画图模块plotnine:第一步安装的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。