时间到2020/10/21遇见 美好
星期三10月21号
你我相遇在美好的春天A BEAUTIFUL SPRING
扫码关注我扫码关注我
爱我就帮我点击“点赞”+“在看”
![3ba0fb07fcaea73ece02fe9bd5007849.png](https://i-blog.csdnimg.cn/blog_migrate/eb78e2d78034a0a42e45a25889d0286f.png)
![ed0ef9d770f8d08fb9412bdadaf92037.png](https://i-blog.csdnimg.cn/blog_migrate/775ad3f6a61b158d8e9e010770c3722d.png)
![9f8185524f197820153a166867f0e04d.png](https://i-blog.csdnimg.cn/blog_migrate/47ad38d5b71639f4d80c574fe0261b8d.png)
今天分享内容
文字样式配置项--TextStyleOpts
图例配置项--LegendOpts
完成阅读大概需要十分钟
文字样式配置项-- TextStyleOptscolor[str] #字体颜色font_style[str] #字体风格,有normal、italic、oblique可选font_weight[str] #字体粗细,有normal、bold、bolder、lighter可选font_family[str] #字体样式font_size[num] #字体大小align[str] #文字水平对齐,默认自动对齐vertical_align[str] #文字垂直对齐,默认自动对齐line_height[str] #行高background_color[str] #文字块背景颜色border_color[str] #边框颜色border_width[str] #边框宽度border_radius[] #文字框圆角padding[(x,x,x,x)] #文字块内边间距,可用元组表示shadow_color[str] #文字块背景阴影颜色shadow_blur[num] #文字块背景阴影长度height[str] #文字块高度width[str] #文字块宽度
图例配置项--LegendOpts
今天代码:
bar = ( Bar() .add_xaxis(x_data) .add_yaxis('商品A', y_data_1) .add_yaxis('商品B', y_data_2) .set_global_opts(legend_opts=opts.LegendOpts(is_show=True, type_='plain', selected_mode='multiple', orient='vertical', inactive_color='#9999ff', legend_icon='pin')))bar.render_notebook()
代码分析:
type_[str] #图例类型,有plain、scroll可选,图例数量多时用selected_mode[str,bool] #图例选择模式,有True、Flase、single、multiple可选,默认是Trueis_show[bool] #是否显示图例组件pos_left\pos_right\pos_top\pos_bottom #和(一)中介绍的一样orient[str] #图例列表的布局朝向,有'horizontal', 'vertical'可选align\padding\item_gap #和(一)中介绍的一样item_height\item_width #图里标记的图形高度\宽度inactive_color[str] # 图例关闭时的颜色。默认是 #ccc legend_icon[str] # 图例项的 icon,有 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none' # 可以通过 'image://url' 设置为图片,url 为图片的链接或 dataURI。 # 可以通过 'path://' 将图标设置为任意的矢量路径。
pyecharts官方文档:https://pyecharts.org/#/zh-cn/intro
![5dce69d194c9b72b3b429233b39b404a.png](https://i-blog.csdnimg.cn/blog_migrate/5a6c7aaf06db4ed9f408ca3ddbea00f2.png)
![0e90b7e42373f93a4039c319d11830be.png](https://i-blog.csdnimg.cn/blog_migrate/2a2a48e8481f4daf1ff7474cd8ec4635.png)
![d5c3165801e83072da4cba6120569a12.png](https://i-blog.csdnimg.cn/blog_migrate/e71b8867496bd19258c8f3316e820a60.jpeg)
![6947a236d87341e1270f37a25aad7955.png](https://i-blog.csdnimg.cn/blog_migrate/e0f11d6b2a3c8f1335525b07ded00ad0.png)