腾讯课堂 | Python网络爬虫与文本分析python
01. 引言
(这种配色真的适合发sci论文)web


02. 基本绘制
import numpy as npimport matplotlib.pyplot as plt
plt.rcParams['font.family'] = "Times New Roman"
#datalabels = ['L1', 'L2', 'L3', 'L4', 'L5']data_a = [20, 34, 30, 35, 27]data_b = [25, 32, 34, 20, 25]data_c = [12, 20, 24, 17, 16]
x = np.arange(len(labels))width = .25#plotsfig,ax = plt.subplots(figsize=(5,3),dpi=200)bar_a = ax.bar(x-width/2, data_a,width,label='category_A')bar_b = ax.bar(x+width/2, data_b, width,label='category_B')bar_c = ax.bar(x+width*3/2, data_c,width,label='category_C')ax.set_xticks(x+.1)ax.set_xticklabels(labels,size=10)ax.legend() text_font = {'size':'14','weight':'bold','color':'black'}ax.text(.03,.93,"(a)",transform = ax.transAxes,fontdict=text_font,zorder=4)ax.text(.87,-.08,'\nVisualization by DataCharm',transform = ax.transAxes, ha='center', va='center',fontsize = 5,color='black',fontweight='bold',family='Roboto Mono')plt.savefig(r'E:\Data_resourses\DataCharm 公众号\Python\学术图表绘制\bar_class_prior.png',width=5,height=3, dpi=900,bbox_inches='tight')plt.show()


03. SCI配色设计
#构造数据labels = ['L1', 'L2', 'L3', 'L4', 'L5']data_a = [20, 34, 30, 35, 27]data_b = [25, 32, 34, 20, 25]data_c = [12, 20, 24, 17, 16]
x = np.arange(len(labels))width = .25
plt.rcParams['font.family'] = "Times New Roman"#plotsfig,ax = plt.subplots(figsize=(5,3),dpi=200)bar_a = ax.bar(x-width/2, data_a,width,label='category_A',color='#130074',ec='black',lw=.5)bar_b = ax.bar(x+width/2, data_b, width,label='category_B',color='#CB181B',ec='black',lw=.5)bar_c = ax.bar(x+width*3/2, data_c,width,label='category_C',color='white',ec='black',lw=.5)
#定制化设计ax.tick_params(axis='x',direction='in',bottom=False)ax.tick_params(axis='y',direction='out',labelsize=8,length=3)ax.set_xticks(x+1)ax.set_xticklabels(labels,size=10)ax.set_ylim(bottom=0,top=40)ax.set_yticks(np.arange(0, 50, step=5))
for spine in ['top','right']: ax.spines[spine].set_color('none') ax.legend(fontsize=7,frameon=False)
text_font = {'size':'14','weight':'bold','color':'black'}ax.text(.03,.93,"(a)",transform = ax.transAxes,fontdict=text_font,zorder=4)ax.text(.87,-.08,'\nVisualization by DataCharm',transform = ax.transAxes, ha='center', va='center',fontsize = 5,color='black',fontweight='bold',family='Roboto Mono')plt.savefig(r'E:\Data_resourses\DataCharm 公众号\Python\学术图表绘制\bar_class.png',width=5,height=3, dpi=900,bbox_inches='tight')plt.show()




bar_c = ax.bar(x+width*3/2, data_c,width,label='category_C',color='#008B45',ec='black',lw=.5)
此外,咱们还添加了网格线,感受还不错,效果以下:微信
04. 总结


近期文章
Python网络爬虫与文本数据分析
rpy2库 | 在jupyter中调用R语言代码 tidytext | 耳目一新的R-style文本分析库 reticulate包 | 在Rmarkdown中调用Python代码 plydata库 | 数据操做管道操做符>> plotnine: Python版的ggplot2做图库
七夕礼物 | 全网最火的钉子绕线图制做教程
读完本文你就了解什么是文本分析
文本分析在经管领域中的应用概述 综述:文本分析在市场营销研究中的应用
plotnine: Python版的ggplot2做图库 小案例: Pandas的apply方法 stylecloud:简洁易用的词云库 用Python绘制近20年地方财政收入变迁史视频 Wow~70G上市公司按期报告数据集
漂亮~pandas能够无缝衔接Bokeh YelpDaset: 酒店管理类数据集10+G
本文分享自微信公众号 - 大邓和他的Python(DaDengAndHisPython)。
若有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一块儿分享。markdown