-
2021-02-09 02:30:19
一,要读取的数据的格式:
二,数据读取部分:
# 1930
workbook=xlrd.open_workbook('1930.xlsx')
sheet= workbook.sheet_by_index(0)
A1=[]
B1=[]
# sheet.cell_value(i,0):第i行的第0个元素
for i in range(1,sheet.nrows):
A1.append(sheet.cell_value(i,0))
B1.append(sheet.cell_value(i,1))
if len(A1)!=len(B1):
print("False")
drawBar(A1,B1,1930)
三,画图函数
1. def drawBar(Music_genre,singer_num,year)
参数介绍
参数名
参数含义
Music_genre
音乐流派名称list
singer_num
音乐流派对应音乐家数量list
year
读的文件的年份(因为源代码是从1840到2020的)
def drawBar(Music_genre,singer_num,year):
arr_len=len(Music_genre)
# 由循环得到一个字典,key是音乐流派,value是这个音乐流派对应的音乐家的数量
i=0
dict_music_singer={}
while i
dict_music_singer[Music_genre[i]]=singer_num[i]
i=i+1
# 注释1
pyplot.bar(x=0, bottom=range(arr_len), height=0.3, width=singer_num, orientation="horizontal")
# 注释2
pyplot.yticks(range(arr_len),Music_genre)
# 加title,展示图像
pyplot.title(year)
pyplot.show()
...
...
drawBar(A1,B1,1930)
注释1:
"""
水平条形图,需要修改以下属性
orientation="horizontal"
"""
import numpy as np
import matplotlib.pyplot as plt
# 数据
N = 5
x = [20, 10, 30, 25, 15]
y = [0,1,2,3,4]
# 绘图 x= 起始位置, bottom= 水平条的底部(左侧), y轴, height 水平条的宽度, width 水平条的长度
p1 = plt.bar(x=0, bottom=y, height=0.5, width=x, orientation="horizontal")
pyplot.bar(range(arr_len),singer_num,align='center')
pyplot.bar(x=0, bottom=range(arr_len), height=0.5, width=singer_num, orientation="horizontal")
# 展示图形
plt.show()
注释2:plt.xticks的第一个参数和plt.plot的第一个参数一样,第二个参数是和第一个参数相同长度的list此例中用来代替横坐标
import matplotlib.pyplot as plt
x = [1, 2, 3, 4]
y = [1, 4, 9, 6]
labels = ['Frogs', 'Hogs', 'Bogs', 'Slogs']
plt.plot(x, y)
# You can specify a rotation for the tick labels in degrees or with keywords.
plt.xticks(x, labels, rotation='vertical')
# Pad margins so that markers don't get clipped by the axes
plt.margins(0.2)
# Tweak spacing to prevent clipping of tick-labels
plt.subplots_adjust(bottom=0.15)
plt.show()
1.1 效果:
1.2 完整代码
import pandas as pd
import numpy as np
import xlrd
from matplotlib import pyplot
def drawBar(Music_genre,singer_num,year):
arr_len=len(Music_genre)
i=0
dict_music_singer={}
while i
dict_music_singer[Music_genre[i]]=singer_num[i]
i=i+1
#pyplot.bar(range(arr_len),singer_num,align='center')
pyplot.bar(x=0, bottom=range(arr_len), height=0.3, width=singer_num, orientation="horizontal")
pyplot.yticks(range(arr_len),Music_genre)
pyplot.title(year)
pyplot.show()
# 1930
workbook=xlrd.open_workbook('1930.xlsx')
sheet= workbook.sheet_by_index(0)
A1=[]
B1=[]
for i in range(1,sheet.nrows):
A1.append(sheet.cell_value(i,0))
B1.append(sheet.cell_value(i,1))
if len(A1)!=len(B1):
print("False")
drawBar(A1,B1,1930)
# 1940
workbook=xlrd.open_workbook('1940.xlsx')
sheet= workbook.sheet_by_index(0)
A2=[]
B2=[]
for i in range(1,sheet.nrows):
A2.append(sheet.cell_value(i,0))
B2.append(sheet.cell_value(i,1))
if len(A2)!=len(B2):
print("False")
drawBar(A2,B2,1940)
#
workbook=xlrd.open_workbook('1950.xlsx')
sheet= workbook.sheet_by_index(0)
A3=[]
B3=[]
for i in range(1,sheet.nrows):
A3.append(sheet.cell_value(i,0))
B3.append(sheet.cell_value(i,1))
if len(A3)!=len(B3):
print("False")
drawBar(A3,B3,1950)
# 6
workbook=xlrd.open_workbook('1960.xlsx')
sheet= workbook.sheet_by_index(0)
A4=[]
B4=[]
for i in range(1,sheet.nrows):
A4.append(sheet.cell_value(i,0))
B4.append(sheet.cell_value(i,1))
if len(A4)!=len(B4):
print("False")
drawBar(A4,B4,1960)
#
workbook=xlrd.open_workbook('1970.xlsx')
sheet= workbook.sheet_by_index(0)
A5=[]
B5=[]
for i in range(1,sheet.nrows):
A5.append(sheet.cell_value(i,0))
B5.append(sheet.cell_value(i,1))
if len(A5)!=len(B5):
print("False")
drawBar(A5,B5,1970)
#
workbook=xlrd.open_workbook('1980.xlsx')
sheet= workbook.sheet_by_index(0)
A6=[]
B6=[]
for i in range(1,sheet.nrows):
A6.append(sheet.cell_value(i,0))
B6.append(sheet.cell_value(i,1))
if len(A6)!=len(B6):
print("False")
drawBar(A6,B6,1980)
# 9
workbook=xlrd.open_workbook('1990.xlsx')
sheet= workbook.sheet_by_index(0)
A7=[]
B7=[]
for i in range(1,sheet.nrows):
A7.append(sheet.cell_value(i,0))
B7.append(sheet.cell_value(i,1))
if len(A7)!=len(B7):
print("False")
drawBar(A7,B7,1990)
# 2000
workbook=xlrd.open_workbook('2000.xlsx')
sheet= workbook.sheet_by_index(0)
A8=[]
B8=[]
for i in range(1,sheet.nrows):
A8.append(sheet.cell_value(i,0))
B8.append(sheet.cell_value(i,1))
if len(A8)!=len(B8):
print("False")
drawBar(A8,B8,2000)
#
workbook=xlrd.open_workbook('2010.xlsx')
sheet= workbook.sheet_by_index(0)
A9=[]
B9=[]
for i in range(1,sheet.nrows):
A9.append(sheet.cell_value(i,0))
B9.append(sheet.cell_value(i,1))
if len(A9)!=len(B9):
print("False")
drawBar(A9,B9,2010)
# #
# workbook=xlrd.open_workbook('2020.xlsx')
# sheet= workbook.sheet_by_index(0)
# A2=[]
# B2=[]
# for i in range(1,sheet.nrows):
# A2.append(sheet.cell_value(i,0))
# B2.append(sheet.cell_value(i,1))
# if len(A2)!=len(B2):
# print("False")
# drawBar(A2,B2,2020)
更多相关内容 -
python读取excel数据+画图
2022-05-24 14:44:08python基本画图 自留使用import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib import rcParams import math import matplotlib #Fonts SETTING config = { "font.family":'serif', "font.size": 18, "mathtext.fontset":'stix', "font.serif": ['Times New Roman']#['SimSun'], } #mac字体不一样 Songti SC windows Simsun rcParams.update(config) #plt.rc('font',family='Times New Roman') # 图框设置 plt.rcParams['xtick.direction'] = 'in' # 将x周的刻度线方向设置向内 plt.rcParams['ytick.direction'] = 'in' # 将y轴的刻度方向设置向内 #读取excel数据 df = pd.read_excel(r'C:\Users\Administrator\Desktop\ABCDFEG.xlsx') data = np.array(df) plt.rcParams['font.sans-serif'] = 'SimSun'
#画图 plt.figure(figsize=(6,8)) #图框大小 plt.ylim(0,80) #坐标范围 plt.xlim(0,3000) plt.plot(data[:,0],data[:,1],'o',markerfacecolor='none',markersize=5,markeredgecolor='k',label='$V_{S}$') #$X_{?}$ $X^{?}$ 下标和上标 plt.plot(data[:,2],data[:,3],'o',c='k',label='$V_{P}$') plt.gca().invert_yaxis() #y轴坐标翻转 plt.grid(linestyle='--',linewidth=1,dashes=(5,5)) #plt.grid设置背景网格 dashes=(5,5)虚线间隔 plt.ylabel('Depth(m)') plt.xlabel('Velocity of propagation(m/s)') # 设置坐标刻度和标签位置 ax = plt.gca() ax.xaxis.set_ticks_position( 'top') #x轴坐标刻度放上面 bottom/top ax.xaxis.set_label_position('top') # 标签/坐标名称 plt.yticks(fontproperties='Times New Roman', size=15) # 坐标刻度字体+尺寸 plt.xticks(fontproperties='Times New Roman', size=15) plt.legend(bbox_to_anchor=(0.5,0.09),loc=10,ncol=1,frameon=False) #设置图例 frameon图例图框 plt.show()
-
Python读取excel数据且横轴是日期的图像绘制
2020-12-21 04:09:31excel里的日期型数据,用python读取出来是这样的: 坐标轴的显示肯定也是有问题的。 该方法就是修改excel数据类型。将日期类型数据修改为文本类型,一定要在数据前面加单引号,这样读取出来的数据 -
python读取excel数据绘制简单曲线图的完整步骤记录
2020-12-16 19:55:12本文使用xlrd读取excel文件(xls,sxls格式),使用xlwt向excel写入数据 一、xlrd和xlwt的安装 安装很简单,windos+r调出运行窗口,输入cmd,进入命令行窗口,输入以下命令。 安装xlrd: pip install xlrd 安装xlwt: ... -
python读取excel数据并且画图的实现示例
2021-02-11 02:43:23一,要读取的数据的格式:二,数据读取部分:b站视频参考:https://www.bilibili.com/video/BV14C4y1W7Nj?t=148# 1930workbook=xlrd.open_workbook('1930.xlsx')sheet= workbook.sheet_by_index(0)A1=[]B1=[]# sheet....一,要读取的数据的格式:
二,数据读取部分:
b站视频参考:https://www.bilibili.com/video/BV14C4y1W7Nj?t=148
# 1930
workbook=xlrd.open_workbook('1930.xlsx')
sheet= workbook.sheet_by_index(0)
A1=[]
B1=[]
# sheet.cell_value(i,0):第i行的第0个元素
for i in range(1,sheet.nrows):
A1.append(sheet.cell_value(i,0))
B1.append(sheet.cell_value(i,1))
if len(A1)!=len(B1):
print("False")
drawBar(A1,B1,1930)
三,画图函数
1. def drawBar(Music_genre,singer_num,year)
参数介绍
参数名
参数含义
Music_genre
音乐流派名称list
singer_num
音乐流派对应音乐家数量list
year
读的文件的年份(因为源代码是从1840到2020的)
def drawBar(Music_genre,singer_num,year):
arr_len=len(Music_genre)
# 由循环得到一个字典,key是音乐流派,value是这个音乐流派对应的音乐家的数量
i=0
dict_music_singer={}
while i
dict_music_singer[Music_genre[i]]=singer_num[i]
i=i+1
# 注释1
pyplot.bar(x=0, bottom=range(arr_len), height=0.3, width=singer_num, orientation="horizontal")
# 注释2
pyplot.yticks(range(arr_len),Music_genre)
# 加title,展示图像
pyplot.title(year)
pyplot.show()
...
...
drawBar(A1,B1,1930)
注释1:
"""
水平条形图,需要修改以下属性
orientation="horizontal"
"""
import numpy as np
import matplotlib.pyplot as plt
# 数据
N = 5
x = [20, 10, 30, 25, 15]
y = [0,1,2,3,4]
# 绘图 x= 起始位置, bottom= 水平条的底部(左侧), y轴, height 水平条的宽度, width 水平条的长度
p1 = plt.bar(x=0, bottom=y, height=0.5, width=x, orientation="horizontal")
pyplot.bar(range(arr_len),singer_num,align='center')
pyplot.bar(x=0, bottom=range(arr_len), height=0.5, width=singer_num, orientation="horizontal")
# 展示图形
plt.show()
注释2:plt.xticks的第一个参数和plt.plot的第一个参数一样,第二个参数是和第一个参数相同长度的list此例中用来代替横坐标
import matplotlib.pyplot as plt
x = [1, 2, 3, 4]
y = [1, 4, 9, 6]
labels = ['Frogs', 'Hogs', 'Bogs', 'Slogs']
plt.plot(x, y)
# You can specify a rotation for the tick labels in degrees or with keywords.
plt.xticks(x, labels, rotation='vertical')
# Pad margins so that markers don't get clipped by the axes
plt.margins(0.2)
# Tweak spacing to prevent clipping of tick-labels
plt.subplots_adjust(bottom=0.15)
plt.show()
1.1 效果:
1.2 完整代码
import pandas as pd
import numpy as np
import xlrd
from matplotlib import pyplot
def drawBar(Music_genre,singer_num,year):
arr_len=len(Music_genre)
i=0
dict_music_singer={}
while i
dict_music_singer[Music_genre[i]]=singer_num[i]
i=i+1
#pyplot.bar(range(arr_len),singer_num,align='center')
pyplot.bar(x=0, bottom=range(arr_len), height=0.3, width=singer_num, orientation="horizontal")
pyplot.yticks(range(arr_len),Music_genre)
pyplot.title(year)
pyplot.show()
# 1930
workbook=xlrd.open_workbook('1930.xlsx')
sheet= workbook.sheet_by_index(0)
A1=[]
B1=[]
for i in range(1,sheet.nrows):
A1.append(sheet.cell_value(i,0))
B1.append(sheet.cell_value(i,1))
if len(A1)!=len(B1):
print("False")
drawBar(A1,B1,1930)
# 1940
workbook=xlrd.open_workbook('1940.xlsx')
sheet= workbook.sheet_by_index(0)
A2=[]
B2=[]
for i in range(1,sheet.nrows):
A2.append(sheet.cell_value(i,0))
B2.append(sheet.cell_value(i,1))
if len(A2)!=len(B2):
print("False")
drawBar(A2,B2,1940)
#
workbook=xlrd.open_workbook('1950.xlsx')
sheet= workbook.sheet_by_index(0)
A3=[]
B3=[]
for i in range(1,sheet.nrows):
A3.append(sheet.cell_value(i,0))
B3.append(sheet.cell_value(i,1))
if len(A3)!=len(B3):
print("False")
drawBar(A3,B3,1950)
# 6
workbook=xlrd.open_workbook('1960.xlsx')
sheet= workbook.sheet_by_index(0)
A4=[]
B4=[]
for i in range(1,sheet.nrows):
A4.append(sheet.cell_value(i,0))
B4.append(sheet.cell_value(i,1))
if len(A4)!=len(B4):
print("False")
drawBar(A4,B4,1960)
#
workbook=xlrd.open_workbook('1970.xlsx')
sheet= workbook.sheet_by_index(0)
A5=[]
B5=[]
for i in range(1,sheet.nrows):
A5.append(sheet.cell_value(i,0))
B5.append(sheet.cell_value(i,1))
if len(A5)!=len(B5):
print("False")
drawBar(A5,B5,1970)
#
workbook=xlrd.open_workbook('1980.xlsx')
sheet= workbook.sheet_by_index(0)
A6=[]
B6=[]
for i in range(1,sheet.nrows):
A6.append(sheet.cell_value(i,0))
B6.append(sheet.cell_value(i,1))
if len(A6)!=len(B6):
print("False")
drawBar(A6,B6,1980)
# 9
workbook=xlrd.open_workbook('1990.xlsx')
sheet= workbook.sheet_by_index(0)
A7=[]
B7=[]
for i in range(1,sheet.nrows):
A7.append(sheet.cell_value(i,0))
B7.append(sheet.cell_value(i,1))
if len(A7)!=len(B7):
print("False")
drawBar(A7,B7,1990)
# 2000
workbook=xlrd.open_workbook('2000.xlsx')
sheet= workbook.sheet_by_index(0)
A8=[]
B8=[]
for i in range(1,sheet.nrows):
A8.append(sheet.cell_value(i,0))
B8.append(sheet.cell_value(i,1))
if len(A8)!=len(B8):
print("False")
drawBar(A8,B8,2000)
#
workbook=xlrd.open_workbook('2010.xlsx')
sheet= workbook.sheet_by_index(0)
A9=[]
B9=[]
for i in range(1,sheet.nrows):
A9.append(sheet.cell_value(i,0))
B9.append(sheet.cell_value(i,1))
if len(A9)!=len(B9):
print("False")
drawBar(A9,B9,2010)
# #
# workbook=xlrd.open_workbook('2020.xlsx')
# sheet= workbook.sheet_by_index(0)
# A2=[]
# B2=[]
# for i in range(1,sheet.nrows):
# A2.append(sheet.cell_value(i,0))
# B2.append(sheet.cell_value(i,1))
# if len(A2)!=len(B2):
# print("False")
# drawBar(A2,B2,2020)
以上就是python读取excel数据并且画图的实现示例的详细内容,更多关于python读取excel数据并且画图的资料请关注聚米学院其它相关文章!
-
python如何读取excel数据并且画图
2021-03-07 00:02:56python如何读取excel数据并且画图发布时间:2021-02-16 19:29:46来源:亿速云阅读:85作者:小新这篇文章主要介绍python如何读取excel数据并且画图,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定...python如何读取excel数据并且画图
发布时间:2021-02-16 19:29:46
来源:亿速云
阅读:85
作者:小新
这篇文章主要介绍python如何读取excel数据并且画图,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
一,要读取的数据的格式:
二,数据读取部分:
b站视频参考:https://www.bilibili.com/video/BV14C4y1W7Nj?t=148# 1930
workbook=xlrd.open_workbook('1930.xlsx')
sheet= workbook.sheet_by_index(0)
A1=[]
B1=[]
# sheet.cell_value(i,0):第i行的第0个元素
for i in range(1,sheet.nrows):
A1.append(sheet.cell_value(i,0))
B1.append(sheet.cell_value(i,1))
if len(A1)!=len(B1):
print("False")
drawBar(A1,B1,1930)
三,画图函数
1. def drawBar(Music_genre,singer_num,year)
参数介绍参数名参数含义Music_genre音乐流派名称list
singer_num音乐流派对应音乐家数量list
year读的文件的年份(因为源代码是从1840到2020的)def drawBar(Music_genre,singer_num,year):
arr_len=len(Music_genre)
# 由循环得到一个字典,key是音乐流派,value是这个音乐流派对应的音乐家的数量
i=0
dict_music_singer={}
while i
dict_music_singer[Music_genre[i]]=singer_num[i]
i=i+1
# 注释1
pyplot.bar(x=0, bottom=range(arr_len), height=0.3, width=singer_num, orientation="horizontal")
# 注释2
pyplot.yticks(range(arr_len),Music_genre)
# 加title,展示图像
pyplot.title(year)
pyplot.show()
...
...
drawBar(A1,B1,1930)
注释1:"""
水平条形图,需要修改以下属性
orientation="horizontal"
"""
import numpy as np
import matplotlib.pyplot as plt
# 数据
N = 5
x = [20, 10, 30, 25, 15]
y = [0,1,2,3,4]
# 绘图 x= 起始位置, bottom= 水平条的底部(左侧), y轴, height 水平条的宽度, width 水平条的长度
p1 = plt.bar(x=0, bottom=y, height=0.5, width=x, orientation="horizontal")
pyplot.bar(range(arr_len),singer_num,align='center')
pyplot.bar(x=0, bottom=range(arr_len), height=0.5, width=singer_num, orientation="horizontal")
# 展示图形
plt.show()
注释2:plt.xticks的第一个参数和plt.plot的第一个参数一样,第二个参数是和第一个参数相同长度的list此例中用来代替横坐标import matplotlib.pyplot as plt
x = [1, 2, 3, 4]
y = [1, 4, 9, 6]
labels = ['Frogs', 'Hogs', 'Bogs', 'Slogs']
plt.plot(x, y)
# You can specify a rotation for the tick labels in degrees or with keywords.
plt.xticks(x, labels, rotation='vertical')
# Pad margins so that markers don't get clipped by the axes
plt.margins(0.2)
# Tweak spacing to prevent clipping of tick-labels
plt.subplots_adjust(bottom=0.15)
plt.show()
1.1 效果:
1.2 完整代码import pandas as pd
import numpy as np
import xlrd
from matplotlib import pyplot
def drawBar(Music_genre,singer_num,year):
arr_len=len(Music_genre)
i=0
dict_music_singer={}
while i
dict_music_singer[Music_genre[i]]=singer_num[i]
i=i+1
#pyplot.bar(range(arr_len),singer_num,align='center')
pyplot.bar(x=0, bottom=range(arr_len), height=0.3, width=singer_num, orientation="horizontal")
pyplot.yticks(range(arr_len),Music_genre)
pyplot.title(year)
pyplot.show()
# 1930
workbook=xlrd.open_workbook('1930.xlsx')
sheet= workbook.sheet_by_index(0)
A1=[]
B1=[]
for i in range(1,sheet.nrows):
A1.append(sheet.cell_value(i,0))
B1.append(sheet.cell_value(i,1))
if len(A1)!=len(B1):
print("False")
drawBar(A1,B1,1930)
# 1940
workbook=xlrd.open_workbook('1940.xlsx')
sheet= workbook.sheet_by_index(0)
A2=[]
B2=[]
for i in range(1,sheet.nrows):
A2.append(sheet.cell_value(i,0))
B2.append(sheet.cell_value(i,1))
if len(A2)!=len(B2):
print("False")
drawBar(A2,B2,1940)
#
workbook=xlrd.open_workbook('1950.xlsx')
sheet= workbook.sheet_by_index(0)
A3=[]
B3=[]
for i in range(1,sheet.nrows):
A3.append(sheet.cell_value(i,0))
B3.append(sheet.cell_value(i,1))
if len(A3)!=len(B3):
print("False")
drawBar(A3,B3,1950)
# 6
workbook=xlrd.open_workbook('1960.xlsx')
sheet= workbook.sheet_by_index(0)
A4=[]
B4=[]
for i in range(1,sheet.nrows):
A4.append(sheet.cell_value(i,0))
B4.append(sheet.cell_value(i,1))
if len(A4)!=len(B4):
print("False")
drawBar(A4,B4,1960)
#
workbook=xlrd.open_workbook('1970.xlsx')
sheet= workbook.sheet_by_index(0)
A5=[]
B5=[]
for i in range(1,sheet.nrows):
A5.append(sheet.cell_value(i,0))
B5.append(sheet.cell_value(i,1))
if len(A5)!=len(B5):
print("False")
drawBar(A5,B5,1970)
#
workbook=xlrd.open_workbook('1980.xlsx')
sheet= workbook.sheet_by_index(0)
A6=[]
B6=[]
for i in range(1,sheet.nrows):
A6.append(sheet.cell_value(i,0))
B6.append(sheet.cell_value(i,1))
if len(A6)!=len(B6):
print("False")
drawBar(A6,B6,1980)
# 9
workbook=xlrd.open_workbook('1990.xlsx')
sheet= workbook.sheet_by_index(0)
A7=[]
B7=[]
for i in range(1,sheet.nrows):
A7.append(sheet.cell_value(i,0))
B7.append(sheet.cell_value(i,1))
if len(A7)!=len(B7):
print("False")
drawBar(A7,B7,1990)
# 2000
workbook=xlrd.open_workbook('2000.xlsx')
sheet= workbook.sheet_by_index(0)
A8=[]
B8=[]
for i in range(1,sheet.nrows):
A8.append(sheet.cell_value(i,0))
B8.append(sheet.cell_value(i,1))
if len(A8)!=len(B8):
print("False")
drawBar(A8,B8,2000)
#
workbook=xlrd.open_workbook('2010.xlsx')
sheet= workbook.sheet_by_index(0)
A9=[]
B9=[]
for i in range(1,sheet.nrows):
A9.append(sheet.cell_value(i,0))
B9.append(sheet.cell_value(i,1))
if len(A9)!=len(B9):
print("False")
drawBar(A9,B9,2010)
# #
# workbook=xlrd.open_workbook('2020.xlsx')
# sheet= workbook.sheet_by_index(0)
# A2=[]
# B2=[]
# for i in range(1,sheet.nrows):
# A2.append(sheet.cell_value(i,0))
# B2.append(sheet.cell_value(i,1))
# if len(A2)!=len(B2):
# print("False")
# drawBar(A2,B2,2020)
以上是“python如何读取excel数据并且画图”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!
-
python读取数据并画图
2018-01-08 16:20:51python 读取数据 作图,读取txt文件,plot画图,调用matplotlib -
Python读取Excel数据并生成图表过程解析
2020-09-16 15:53:49主要介绍了Python读取Excel数据并生成图表过程解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 -
利用python在excel中画图的实现方法
2020-12-20 11:30:59今个学了一个来月python,膨胀了就想用excel画图。当然,其实用画图这个词不甚严谨,实际上是利用opencv遍历每一个像素的rgb值,再将其转化为16进制,最后调用openpyxl进行填充即可。 1.1、实现效果 效果如下图 1.2... -
Python读取Excel表格,并同时画折线图和柱状图的方法
2020-09-20 01:20:53今天小编就为大家分享一篇Python读取Excel表格,并同时画折线图和柱状图的方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧 -
python读取excel并绘图
2020-08-04 21:57:50python读取excel并绘图的代码 import openpyxl import matplotlib.pyplot as plt wb = openpyxl.load_workbook('渗透记录表(1).xlsx') # 载入excel工作簿 a = wb.get_sheet_names() # 获取工作簿中所有工作表的名字... -
python提取excel内容并plot画图
2022-06-14 14:59:13python、读取excel、plot画图 -
Python读取Excel数据并绘制折线图
2021-09-30 16:22:54df = pd.read_excel("excel文件.xlsx") print(df) print(df["X"]) # 显示中文 plt.rcParams['font.sans-serif'] = ['SimHei'] plt.rcParams['axes.unicode_minus'] = False plt.plot(df["日期"], df["X"], label='... -
python读取excel数据并制图
2021-01-14 23:39:24#读excel数据#打开文件数据= _workbook (' E: \\桌面\\ ')表= _by_index(0) #得到总行数nrows = #得到的总数列ncols = #得到一个列的值,比如第四列4 = _values(3) #一个列的值,例如,第八列6 = _values (7) j = 0 h =... -
读取excel的数据并作图——python实现
2020-01-16 14:09:241.将excel数据导入python中 2.读取数据 3.作图 效果: 代码如下: import xlrd import matplotlib.pyplot as plt #调节字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 用来正常显示中文标签 plt.rcParams['... -
使用python读取excel中的数据,并绘制折线图
2020-01-09 13:23:29使用python读取excel中的数据,并绘制折线图 做实验的时候采集到一些数据,从文本拷贝到excel,然后从十六进制转换成十进制。图表时分析数据的有利工具,使用python绘制出的图标简明美观。所以我这次尝试一下。... -
利用Python获取excel的数据并绘制直方图(保姆级教程,含多组样例)
2021-05-31 03:18:17利用Python获取excel的数据并绘制直方图(保姆级教程,含多组样例) -
Python读取excel表格数据并绘制成柱状图 | 数据排序、柱状图颜色、标签乱码等问题通通能够解决!
2020-05-17 14:47:50hello大家好, 我是你们的可爱丸, 我们又见面啦! python的功能十分强大, ...1、首先我们需要在python中读取表格test.xlsx的数据,并在控制台输出表格数据,检查所选择的表格是否为目标表格 #导入需要用. -
Echarts基础:用python读取excel数据的网页可视化
2021-10-22 14:34:51python基础 + python读取excel数据 + Echarts图表可视化 记录一下课程内容,巩固记忆。 Echarts简介: Apache ECharts是一个基于 JavaScript 的开源可视化图表库,提供直观,生动,可交互,可个性化定制的数据... -
Python读取excel画图
2019-12-26 14:45:46excel表格共6列,分别存储x1,y1,z1,x2,y2,z2的值 代码如下: import pandas as pd import matplotlib.pyplot as plt import numpy as np #这个会直接默认读取到这个Excel的第一个表单 excel1=pd.read_excel('D:/... -
python读取excel数据使用pyecharts展示
2021-06-02 15:59:20# -*- coding: utf-8 -*- # @Time : 2021/6/2 13:48 # @Project : monthreport # @Author : testing ...from common.do_excel import ReadExcel from pyecharts import options as opts from pyechar... -
python3.4读取excel数据绘图
2017-06-23 12:40:00/usr/bin/env python 2 # -*- coding:utf-8 -*- 3 # __author__ = "blzhu" 4 """ 5 python study 6 Date:2017 7 """ 8 # coding=utf-8 9 #################################################...