可以用python做科研图吗_python绘制高清、有颜值的科研图

欢迎转载,转载请保留以下微信公众号二维码,感谢大家支持

今天我们要做的图如下格式:

平时时间太少,不说废话,直接给大家发布Python代码了:

import numpy as np

import matplotlib.pyplot as plt

up_num = (-210, -300, -450, -175, -287)

down_num = (295, 320, 450, 106, 65)

fig, ax = plt.subplots()

ind = np.arange(len(up_num)) # the x locations for the groups

width = 0.35 # the width of the bars

rects1 = ax.bar(ind, up_num, width, color='green', label='up_num')

rects2 = ax.bar(ind, down_num, width, color='red', label='down_num')

# Add some text for labels, title and custom x-axis tick labels, etc.

ax.set_ylabel('Gene number')

ax.set_title('The DEGs')

ax.set_xticks(ind)

ax.set_xticklabels(('Treatmen_1', 'Treatmen_2', 'Treatmen_3', 'Treatmen_4', 'Treatmen_5'))

ax.legend(loc = 'best')

ax.spines['right'].set_color('none')

ax.spines['top'].set_color('none')

ax.set_ylim(-600,600)

#ax.spines['bottom'].set_position(('data', 0))

#ax.spines['left'].set_position(('data', 0))

plt.show()

plt.savefig('C:/Users/Administrator/Desktop/result.pdf')

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值