python数据分析案例1:股票数据分析(四):利用 Anaconda3.X + jupyterlab 绘制图表

转载自:https://www.jianshu.com/p/5687daba6822

本文介绍:Anaconda + jupyterlab 简单使用: 绘制图表

在第一篇中我们介绍了Anaconda的安装,现在打开安装软件:

图片.png

1: 进入首页的样子:

图片.png

2: 我们选择jupyterlab体验一下, 点击启动(Launch) jupyterlab,自动打开网页:

我们选择第一个:

 

图片.png

3: 选择后:

图片.png

4: 偷个懒,网上谁便找一段Python绘制图标代码:

https://blog.csdn.net/xiaodongxiexie/article/details/53123371
复制第一段代码:

 

import numpy as np
import pandas as pd
from pandas import Series, DataFrame
import matplotlib.pyplot as plt
%matplotlib inline

fig = plt.figure(figsize=(10,8))  #建立一个大小为10*8的画板
ax1 = fig.add_subplot(331)  #在画板上添加3*3个画布,位置是第1个
ax2 = fig.add_subplot(3,3,2)
ax3 = fig.add_subplot(3,3,3)
ax4 = fig.add_subplot(334)
ax5 = fig.add_subplot(3,3,5)
ax6 = fig.add_subplot(3,3,6)
ax7 = fig.add_subplot(3,3,7)
ax8 = fig.add_subplot(3,3,8)
ax9 = fig.add_subplot(3,3,9)

ax1.plot(np.random.randn(10))
_ = ax2.scatter(np.random.randn(10),np.arange(10),color='r')  #作散点图
ax3.hist(np.random.randn(20),bins=10,alpha=0.3)  #作柱形图
ax4.bar(np.arange(10),np.random.randn(10))  #做直方图
ax5.pie(np.random.randint(1,15,5),explode=[0,0,0.2,0,0])  #作饼形图

x = np.arange(10)
y = np.random.randn(10)
ax6.plot(x,y,color='green')
ax6.bar(x,y,color='k')

data = DataFrame(np.random.randn(1000,10),
                 columns=['one','two','three','four','five','six','seven','eight','nine','ten'])
data2 = DataFrame(np.random.randint(0,20,(10,2)),columns=['a','b'])
data.plot(x='one',y='two',kind='scatter',ax=ax7)  #针对DataFrame的一些作图
data2.plot(x='a',y='b',kind='bar',ax=ax8,color='red',legend=False)
data2.plot(x='a',y='b',kind='barh',color='m',ax=ax9)
#plt.tight_layout() #避免出现叠影
#plt.show()

图片.png

运行结果:

图片.png


 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值