Python可視化神器pyecharts繪制水球圖
水球圖
水球圖首先是動(dòng)態(tài)的效果,像水流一樣波動(dòng),所以看起來(lái)比較的舒服,一般用于業(yè)務(wù)里面的完成率,其實(shí)和之前的儀表盤(pán)有點(diǎn)類(lèi)似,但是我個(gè)人絕對(duì)水球圖更加的好,因?yàn)榭雌饋?lái)比較的炫酷。
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í)只需要變動(dòng)一下參數(shù)即可,和最開(kāi)始的那個(gè)差不多。
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")
)
炫酷水球超級(jí)好看
感覺(jué)這個(gè)顏色搭配還是不錯(cuò)的
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("無(wú)邊框水球圖.html")
)
到此這篇關(guān)于Python可視化神器pyecharts繪制水球圖的文章就介紹到這了,更多相關(guān) Python繪制水球圖內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
通過(guò)淘寶數(shù)據(jù)爬蟲(chóng)學(xué)習(xí)python?scrapy?requests與response對(duì)象
本文主要介紹了通過(guò)淘寶數(shù)據(jù)爬蟲(chóng)學(xué)習(xí)python?scrapy?requests與response對(duì)象,首先從Resquest和Response對(duì)象開(kāi)始展開(kāi)詳細(xì)文章,需要的小伙伴可以參考一下2022-05-05
深入了解Python中計(jì)數(shù)器Counter的使用
計(jì)數(shù)器counter是包含在collections模塊中的容器,這篇文章主要來(lái)和大家聊聊計(jì)數(shù)器counter的使用,感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2023-09-09
利用Python進(jìn)行音頻信號(hào)處理和音樂(lè)生成的代碼示例
隨著計(jì)算機(jī)技術(shù)的快速發(fā)展,音頻信號(hào)處理和音樂(lè)生成逐漸成為了Python程序員們的關(guān)注點(diǎn),本文將介紹如何利用Python進(jìn)行音頻信號(hào)處理和音樂(lè)生成,包括基本概念、常用庫(kù)的使用以及實(shí)際的代碼示例,需要的朋友可以參考下2024-06-06
wxPython學(xué)習(xí)之主框架實(shí)例
這篇文章主要介紹了wxPython學(xué)習(xí)之主框架應(yīng)用實(shí)例,以一個(gè)基礎(chǔ)的彈出窗體實(shí)例講述了wxPython主框架應(yīng)用程序的實(shí)現(xiàn)方法,需要的朋友可以參考下2014-09-09
Python pexpect模塊及shell腳本except原理解析
這篇文章主要介紹了Python pexpect模塊及shell腳本except原理解析,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-08-08

