def pic_wordcloud_user_jov_base(): """ It is used to respond to requests for chart parameters. Returns ------- image : TYPE-IMAGE Component parameters DESCRIPTION:IMAGE html parameters. """ # get picture from wordcloud import WordCloud data_pair = user_job_wordcloud_freq_query() wc = WordCloud(width=1200,height=800,min_font_size=10,max_font_size=100,font_step=2,max_words=10000,background_color="white") wc.generate_from_frequencies(dict(data_pair)) wc.to_file(os.path.join(config.image_dir,"wordcloud_user_job.png")) # render picture from pyecharts.components import Image from pyecharts.options import ComponentTitleOpts image = Image() img_src = (os.path.join(config.image_dir,"wordcloud_user_job.png")) image.add(src=img_src, style_opts={"width": "1200px", "height": "800px", "style": "margin-top: 20px"}, ) image.set_global_opts(title_opts=ComponentTitleOpts(title="User Occupation Analysis")) return image
def title(fea_data, style_data) -> Image: image = Image() sub_data = "" for i in range(len(fea_data)): if i == 0: sub_data += "关于面向用例:\n" if i == 3: sub_data += "\n关于提交次数:\n" if i == 4: sub_data += "\n关于时间偏好:\n" if i == 9: sub_data += "\n面对难题:\n" sub_data = sub_data + fea_data[i] + "\n" for i in range(len(style_data)): if i == 0: sub_data += "\n\n代码风格评估:\n" sub_data = sub_data + style_data[i] if i == 2: sub_data += "\n" if i == 3: sub_data += "\n" if i == 5: sub_data += "\n" # img_src = ( # "/Users/amanda/Data_Science/src/可视化/title.png" # ) # image.add( # src=img_src, # style_opts={"width": "200px", "height": "200px", "style": "margin-top: 20px"}, # ) image.set_global_opts(title_opts=ComponentTitleOpts(title="PYTHON 用户数据分析", subtitle=sub_data)) return image
def draw_cloud(url,user_id,title = "用户词云"): image = Image() image.add( src=url, style_opts={"width": "800px", "height": "500px", "style": "margin-left: 200px"}, ) image.set_global_opts( title_opts=ComponentTitleOpts(title=title, subtitle="用户:"+str(user_id)) ) return image
from pyecharts.components import Image from pyecharts.options import ComponentTitleOpts image = Image() img_src = ("https://user-images.githubusercontent.com/19553554/" "71825144-2d568180-30d6-11ea-8ee0-63c849cfd934.png") image.add( src=img_src, style_opts={ "width": "200px", "height": "200px", "style": "margin-top: 20px" }, ) image.set_global_opts( title_opts=ComponentTitleOpts(title="Image-基本示例", subtitle="我是副标题支持换行哦")) image.render("image_base.html")