top_bar的布局

<Button
        android:id="@+id/leftButton"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_marginLeft="5dp" />

    <TextView
        android:id="@+id/titleText"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_centerHorizontal="true"
        android:gravity="center" />
    <Button
        android:id="@+id/rightButton"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_marginRight="5dp" />

 

import csv chinese=[] number=[] with open('./数据1.csv', 'r', encoding='gbk') as file: reader = csv.reader(file) for row in reader: # print(row) # 第一竖列中文 chinese.append(row[0][0:3]) # 第二竖列去掉最后一个符号万 number.append(row[1][:-1]) print(chinese[1:]) print(number[1:]) #显示出来排名前20的品牌和价格 import matplotlib.pyplot as plt from wordcloud import WordCloud import matplotlib sorted_list = sorted(number[1:], reverse=True) top_10 = sorted_list[:20] top_10_indices = [number.index(num) for num in top_10[:20]] print(top_10) print(top_10_indices) result = [chinese[i] for i in top_10_indices] print(result) # 画折线图 font = {'family': 'SimHei', "size": 24} matplotlib.rc('font', **font) plt.plot(result, top_10) plt.tick_params(axis='x', labelsize=8) plt.tick_params(axis='y', labelsize=8) plt.show() # 画柱状图 plt.bar(result, top_10,width=0.5) plt.tick_params(axis='x', labelsize=8) plt.tick_params(axis='y', labelsize=8) plt.show() def generate_wordcloud(text): # 生成词云对象 wc = WordCloud( font_path='C:/Windows/Fonts/simhei.ttf', # 设置字体 background_color='white', # 设置背景颜色 max_words=200, # 设置最大显示的单词数量 max_font_size=100 # 设置最大的字体大小 ) # 生成词云 wc.generate(text) # 显示词云 plt.imshow(wc, interpolation='bilinear') plt.axis('off') plt.show() # 将列表转换为字符串 text = ' '.join(result) # 生成词云 generate_wordcloud(text) #价格热力图 import plotly.graph_objs as go from plotly.subplots import make_subplots # 创建子图 fig = make_subplots(rows=1, cols=1) # 添加热力图 fig.add_trace(go.Heatmap(z=[top_10], x=result, y=['']), row=1, col=1) # 更新布局 fig.update_layout(title='价格热力图', xaxis_title='价格', yaxis_title='') # 保存为html文件 fig.write_html('./热力图.html')这里的三个错误怎么改正
06-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值