Python可視化神器pyecharts繪制水球圖
水球圖
水球圖首先是動態(tài)的效果,像水流一樣波動,所以看起來比較的舒服,一般用于業(yè)務(wù)里面的完成率,其實和之前的儀表盤有點類似,但是我個人絕對水球圖更加的好,因為看起來比較的炫酷。
from pyecharts import options as opts
from pyecharts.charts import Liquid
from pyecharts.globals import SymbolType
c = (
Liquid()
.add("完成", [0.7, 0.3], is_outline_show=False, shape=SymbolType.DIAMOND)
.set_global_opts(title_opts=opts.TitleOpts(title="業(yè)務(wù)完成率"))
.render("菱形水球圖.html")
)
雙水球圖顯示
from pyecharts import options as opts
from pyecharts.charts import Grid, Liquid
from pyecharts.commons.utils import JsCode
l1 = (
Liquid()
.add("lq", [0.6, 0.7], center=["60%", "50%"])
.set_global_opts(title_opts=opts.TitleOpts(title="標(biāo)題"))
)
l2 = Liquid().add(
"lq",
[0.3],
center=["25%", "50%"],
label_opts=opts.LabelOpts(
font_size=50,
formatter=JsCode(
"""function (param) {
return (Math.floor(param.value * 10000) / 100) + '%';
}"""
),
position="inside",
),
)
grid = Grid().add(l1, grid_opts=opts.GridOpts()).add(l2, grid_opts=opts.GridOpts())
grid.render("雙水球圖顯示.html")
正方形水球圖
其實只需要變動一下參數(shù)即可,和最開始的那個差不多。
from pyecharts import options as opts
from pyecharts.charts import Liquid
from pyecharts.globals import SymbolType
c = (
Liquid()
.add("lq", [0.7, 0.7], is_outline_show=False, shape=SymbolType.RECT)
.set_global_opts(title_opts=opts.TitleOpts(title="標(biāo)題"))
.render("正方形.html")
)
圓球水球圖
from pyecharts import options as opts
from pyecharts.charts import Liquid
c = (
Liquid()
.add("lq", [0.7, 0.7])
.set_global_opts(title_opts=opts.TitleOpts(title="圓球"))
.render("圓球.html")
)
數(shù)據(jù)精度水球圖
from pyecharts import options as opts
from pyecharts.charts import Liquid
from pyecharts.commons.utils import JsCode
c = (
Liquid()
.add(
"lq",
[0.3254],
label_opts=opts.LabelOpts(
font_size=50,
formatter=JsCode(
"""function (param) {
return (Math.floor(param.value * 10000) / 100) + '%';
}"""
),
position="inside",
),
)
.set_global_opts(title_opts=opts.TitleOpts(title="標(biāo)題"))
.render("數(shù)據(jù)精度水球圖.html")
)
炫酷水球超級好看
感覺這個顏色搭配還是不錯的
from pyecharts import options as opts
from pyecharts.charts import Liquid
c = (
Liquid()
.add("lq", [0.6, 0.7, 0.8], is_outline_show=False)
.set_global_opts(title_opts=opts.TitleOpts(title="標(biāo)題"))
.render("無邊框水球圖.html")
)
到此這篇關(guān)于Python可視化神器pyecharts繪制水球圖的文章就介紹到這了,更多相關(guān) Python繪制水球圖內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
通過淘寶數(shù)據(jù)爬蟲學(xué)習(xí)python?scrapy?requests與response對象
本文主要介紹了通過淘寶數(shù)據(jù)爬蟲學(xué)習(xí)python?scrapy?requests與response對象,首先從Resquest和Response對象開始展開詳細文章,需要的小伙伴可以參考一下2022-05-05
Python pexpect模塊及shell腳本except原理解析
這篇文章主要介紹了Python pexpect模塊及shell腳本except原理解析,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2020-08-08

