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="標題")) ) 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="標題")) .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="標題")) .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="標題")) .render("無邊框水球圖.html") )
到此這篇關(guān)于Python可視化神器pyecharts繪制水球圖的文章就介紹到這了,更多相關(guān) Python繪制水球圖內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
TensorFlow實現(xiàn)AutoEncoder自編碼器
這篇文章主要為大家詳細介紹了TensorFlow實現(xiàn)AutoEncoder自編碼器,具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-03-03淺談pandas中Dataframe的查詢方法([], loc, iloc, at, iat, ix)
下面小編就為大家分享一篇淺談pandas中Dataframe的查詢方法([], loc, iloc, at, iat, ix),具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-04-04