ggplot2作图库
R语言的ggplot2绘图能力超强,python虽有matplotlib,但是语法臃肿,使用复杂,入门极难,seaborn的出现稍微改善了matplotlib代码量问题,但是定制化程度依然需要借助matplotlib,使用难度依然很大。
通过plotnine这个库,你就可以在python世界中体验下R语言的新奇感,体验可视化之美。
plotnine包,可以实现绝大多数ggplot2的绘图功能,两者语法十分相似,R和Python的语法转换成本大大降低。
-
plotnine文档 https://plotnine.readthedocs.io/en/latest/
-
R语言ggplot2文档 https://ggplot2.tidyverse.org/reference/index.html
安装
pip install plotnine
准备数据
from plotnine.data import mpg
#dataframe
mpg.head()
manufacturer | model | displ | year | <
---|