from pyecharts import options as opts from pyecharts.charts import Scatter x=['一月','二月','三月','四月','五月','六月','七月','八月','九月'] y=[8,5,3,4,8,2,2,5,1] c = ( Scatter() .add_xaxis(x) .add_yaxis("", y) .set_global_opts( title_opts=opts.TitleOpts(title="气泡图"), visualmap_opts=opts.VisualMapOpts( range_opacity=0.45, type_="size", max_=10, is_piecewise=True, dimension=0, pieces=[ {"lte": 2, "color": "green"}, {"gt": 2, "lte": 4, "color": "red"}, {"gt": 4, "lte": 6, "color": "yellow"}, {"gt": 6, "lte": 8, "color": "red"}, {"gt": 8, "color": "green"}, ], pos_right=0, pos_bottom=100) ))c.render_notebook() |