Python-joypy和 R-ggridges 峰峦图制作

Python-joypy和 R-ggridges 峰峦图制作[Python常见问题]

本文的文字及图片来源于网络,仅供学习、交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理。

以下文章来源于DataCharm,作者 宁海涛

转载地址

https://www.zhihu.com/people/qi-shi-huan-hao-la-14/posts

Python-joypy 制作

Python 制作峰峦图有直接的第三方库joypy进行绘制,该库可以直接通过pip安装。可视化代码如下:

import matplotlib.pyplot as plt
plt.rcParams["font.family"] = ["Times New Roman"]
colors = ["#791E94","#58C9B9","#519D9E","#D1B6E1"]
fig,axs = joypy.joyplot(data_ed, by="source",fill=True, legend=True,alpha=.8,
                         range_style="own",xlabelsize=22,ylabelsize=22,
                         grid="both", linewidth=.8,linecolor="k", figsize=(12,6),color=colors,
                       )ax = plt.gca()#设置x刻度为时间形式x = np.arange(6)
xlabel=["8-21","8-28","9-4","9-11","9-18","9-25"]
ax.set_xlim(left=-.5,right=5.5)
ax.set_xticks(x)ax.set_xticklabels(xlabel)ax.text(.47,1.1,"Joyplot plots of media shares (TV, Online News and Google Trends)",
        transform = ax.transAxes,ha="center", va="center",fontsize = 25,color="black")
ax.text(.5,1.03,"Python Joyplot Test",
        transform = ax.transAxes,ha="center", va="center",fontsize = 15,color="black")
ax.text(.90,-.11,"
Visualization by DataCharm",transform = ax.transAxes,
        ha="center", va="center",fontsize = 12,color="black")
plt.savefig(r"F:DataCharmArtist_charts_make_python_RjoyplotsJoyplot_python.png",
            width=7,height=5,dpi=900,bbox_inches="tight")
hmoban主题是根据ripro二开的主题,极致后台体验,无插件,集成会员系统
自学咖网 » Python-joypy和 R-ggridges 峰峦图制作