-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbar_with_axis_off.py
More file actions
30 lines (24 loc) · 1008 Bytes
/
bar_with_axis_off.py
File metadata and controls
30 lines (24 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : AwesomeTang
# @File : bar_with_axis_off.py
# @Version : Python 3.7
# @Time : 2020-11-15 15:32
from pyecharts.charts import *
from pyecharts import options as opts
from pyecharts.faker import Faker
def bar_with_axis_off():
bar = Bar(init_opts=opts.InitOpts(theme='light',
width='1000px',
height='600px'))
bar.add_xaxis(Faker.choose())
bar.add_yaxis('', Faker.values())
# 碰上类目标签过长的时候,可以选择关闭坐标轴,直接显示在图形中
bar.set_series_opts(label_opts=opts.LabelOpts(position='insideLeft', formatter='{b}:{c}'))
bar.set_global_opts(xaxis_opts=opts.AxisOpts(is_show=False),
yaxis_opts=opts.AxisOpts(is_show=False))
bar.reversal_axis()
return bar
if __name__ == '__main__':
chart = bar_with_axis_off()
chart.render(path='chart_output/bar_with_axis_off.html')