- 项目基于 pyecharts
2.0.3
版本进行展示 - Apache ECharts (incubating) 官方实例
- 项目代码结构按照 pyecharts 支持的组件按大写字母顺序进行模块划分
- 代码内有根据
2.0.3
版本的 pyecharts 所生成的可视化数据视图和官方的进行对比, 有列出能实现的功能以及未实现的功能 - 以下图例多数会基于 Echarts 的官方实例,不过也有部分会基于 Echarts 的社区 Gallery 实现
Just use pyecharts to imitate Echarts official example.
Home Page: https://gallery.pyecharts.org
License: MIT License
2.0.3
版本进行展示2.0.3
版本的 pyecharts 所生成的可视化数据视图和官方的进行对比, 有列出能实现的功能以及未实现的功能osVersionPip = (
Pie()
.add(
"",
osVersion(),
radius=["55", "40%"],
center=["38%", "28%"],
label_opts=opts.LabelOpts(
position="outside",
#formatter="{a|{a}}{abg|}\n{hr|}\n {b|{b}: }{c} {per|{d}%} ",
formatter="{hr|}\n {b|{b}: }{c} {per|{d}%} ",
background_color="#eee",
border_color="#aaa",
border_width=1,
border_radius=5,
rich={
#"a": {"color": "#999", "lineHeight": 5, "align": "center"},
"abg": {
"backgroundColor": "#e3e3e3",
"width": "100%",
"align": "right",
"height": 22,
"borderRadius": [4, 4, 0, 0],
},
"hr": {
"borderColor": "#aaa",
"width": "100%",
"borderWidth": 1,
"height": 0,
},
"b": {"fontSize": 11, "lineHeight": 25},
"per": {
"color": "#eee",
"backgroundColor": "#334455",
"padding": [2, 4],
"borderRadius": 2,
},
},
),
)
#.set_global_opts(title_opts=opts.TitleOpts(title="操作系统版本信息"))
.set_global_opts(
#title_opts=opts.TitleOpts(title="Pie-Legend 滚动"),
legend_opts=opts.LegendOpts(type_="scroll", pos_left="85%",orient="vertical"),
)
#.render("./templates/osVersionPip.html")
)
osTypePip = (
Pie()
.add(
"",
osType(),
radius=["55", "40%"],
center=["38%", "80%"],
label_opts=opts.LabelOpts(
position="outside",
#formatter="{a|{a}}{abg|}\n{hr|}\n {b|{b}: }{c} {per|{d}%} ",
formatter="{hr|}\n {b|{b}: }{c} {per|{d}%} ",
background_color="#eee",
border_color="#aaa",
border_width=1,
border_radius=5,
rich={
#"a": {"color": "#999", "lineHeight": 5, "align": "center"},
"abg": {
"backgroundColor": "#e3e3e3",
"width": "100%",
"align": "right",
"height": 22,
"borderRadius": [4, 4, 0, 0],
},
"hr": {
"borderColor": "#aaa",
"width": "100%",
"borderWidth": 1,
"height": 0,
},
"b": {"fontSize": 11, "lineHeight": 25},
"per": {
"color": "#eee",
"backgroundColor": "#334455",
"padding": [2, 4],
"borderRadius": 2,
},
},
),
)
#.set_global_opts(title_opts=opts.TitleOpts(title="操作系统版本信息"))
.set_global_opts(
#title_opts=opts.TitleOpts(title="Pie-Legend 滚动"),
legend_opts=opts.LegendOpts(type_="scroll", pos_top="55%" ,pos_left="85%",orient="vertical",is_show=True),
)
#.render("./templates/osVersionPip.html")
)
grid = (
Grid()
.add(osTypePip,grid_opts=opts.GridOpts(pos_bottom="60%"))
.add(osVersionPip, grid_opts=opts.GridOpts(pos_top="60%"))
.render("./templates/grid_horizontal.html")
)
It would help many to use English in the user interface. Usually people do expect English language as the default language when working with CLI applications and tools.
关系图中的linestyle,可以为每条线单独设置线宽吗?或者随着权重矩阵而变化。
我的正常程序是这样的,
import pyecharts.options as opts
from pyecharts.charts import Bar
m_, n_ = [m for m in range(0, 12 +1)], range(1, 4 +1)
bar = (
Bar() # init_opts=opts.InitOpts(width="1600px", height="800px")
.add_xaxis(xaxis_data=m_)
.set_global_opts(
# title_opts=opts.TitleOpts(title="柱状图动画延迟"),
xaxis_opts=opts.AxisOpts(splitline_opts=opts.SplitLineOpts(is_show=False)),
yaxis_opts=opts.AxisOpts(
axistick_opts=opts.AxisTickOpts(is_show=True),
splitline_opts=opts.SplitLineOpts(is_show=True),
),
)
)
for n in n_:
bar.add_yaxis(
series_name=f"n={n}",
yaxis_data=[np.abs(Bcomp_smn[coilsys][coil]['b1_bis'][s_ind,m,n]) for m in m_],
label_opts=opts.LabelOpts(is_show=False)
)
bar.render_notebook()
但是如果我将横坐标的数组更换成了直接用 range 函数,m_ = range(0, 15 +1)
同时,如果我将 y 数据喂进去的是 numpy 数组而不是 list 类型,会出现空图。似乎 echarts 没法处理不是 list 型的数据?
在设定关系图中结点的大小的时候,如果是手动设定的,做出来的图结点该多大就多大,但是如果是用循环的方式自动设定结点的大小就会导致所有的节点都一样大;如果用循环的方式设定节点里的value,会导致做出来的图节点上的值显示为"null"。这个bug要怎么解决
图表功能应仅作为展示,不应判断header内容是否重复。
In this example, there is no problem with Render Geo data alone. Once combined with Grid, add Bar, Line, and Geo data, it becomes an immutable floating point number. Is this a bug?
这个示例,单独render geo数据没有问题,一旦结合grid,添加bar,line,geo的数据就变成不可更改的浮点数了,这是一个bug吧?
您好,pyecharts-gallery 中的demo运行时都不报错,但是显示不了图表,请问这是什么原因?
pyecharts 版本1.6.0
python 3.7
IDE: Pycharm
您好,请问两个节点间画超过2个边可以实现吗?目前好像会覆盖
axis equal如何实现
目前没有办法同时设置横轴和纵轴的zoom。请指教。
It‘s very stange that everything is OK when use the gallery of Geo-Line in 'china' mapttyep, but not work change the maptype to 'world'? I try the different country label like 'Unite States', 'US', '美国' and it's dosen't work.
Who can tell me how to make a world geo line map? Thanks a lot~
MakeLine生成的线,只能精准到0.01,0.005无法区别出来,比如如下的代码Line线设置的是0.025,但实际生成的Line是0.03
import pyecharts.options as opts
from pyecharts.charts import Line
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y = [0.01, 0.015, 0.025, 0.03, 0.045, 0.023, 0.035, 0.052, 0.043, 0.037]
spec = 0.025
line = (
Line()
.add_xaxis(xaxis_data=x)
.add_yaxis(
series_name="A",
y_axis=y,
is_smooth=True,
label_opts=opts.LabelOpts(is_show=False),
)
.set_series_opts(
markline_opts=opts.MarkLineOpts(
symbol="none",
label_opts=opts.LabelOpts(
is_show=False,
),
data=[opts.MarkLineItem(y=spec, name="SPEC")],
linestyle_opts=opts.LineStyleOpts(
type_="dotted",
color="rgb(208,2,27)",
)
),
)
)
line.render("Spec Line.html")
用timeline组件的时候发现时间下标数量不稳定,四个五个六个七个都出现过,当然我赋值的数量远远大于这些值,在几百个的数量级,如何做才能全部生成?
源程序如下,可直接运行
import pyecharts
from pyecharts.charts import Line
from pyecharts import options as opts
x = list(range(0, 10))
y1 = [i * 2 + 1 for i in list(range(0, 10))]
#y2 = [i * 3 + 2 for i in list(range(0, 10))]
y3 = [(i+1)/10 * 3 for i in list(range(0, 10))]
line = (
Line()
.add_xaxis(x)
.add_yaxis("y1", y1
,color="green",is_symbol_show=True #第一轴设置为绿色
,label_opts=opts.LabelOpts(is_show=False)
)
.extend_axis(yaxis=opts.AxisOpts( name="y3"))
.set_global_opts(title_opts=opts.TitleOpts(title="双坐标轴Demo",pos_right="50%") # 设置标题
,legend_opts=opts.LegendOpts(pos_right="10%",pos_top="50%",orient="vertical") # 设置图例
,tooltip_opts =opts.TooltipOpts(trigger='axis',axis_pointer_type='cross')
# ,toolbox_opts =opts.ToolboxOpts(is_show=True,orient='horizontal')
,xaxis_opts =opts.AxisOpts(name="X")
,yaxis_opts =opts.AxisOpts(name="Y")
)
)
line1 = (Line()
.add_xaxis(x)
.add_yaxis("y3", y3
,color="blue",is_symbol_show=True #第二轴想设置为蓝色,但是图中是红色了,不知为何?
,label_opts=opts.LabelOpts(is_show=False)
, yaxis_index=1))
line.overlap(line1)
line.render_notebook()
截图不会放。
开发大大帮忙看看,github速度超慢,请邮件:[email protected]
self. render(index.html,content=bar.dump_options())
{%raw content%}
显示不出来有什么办法吗?
请问关系图怎样显示边的标签(edge label)?
The step line is usually adopted to show the value changing over time, and the value will keep the same until next point, so it's better to add an option to choose the step line generate option.
shown in the pic:
The red line is currently in use: pref-step, value changed in advance;
The blue line, post-step, value change until new value comes.
import random
from example.commons import Collector, Faker
from pyecharts import options as opts
from pyecharts.charts import Page, Scatter3D
C = Collector()
@C.funcs
def scatter3d_base() -> Scatter3D:
data = test2
c = (
Scatter3D()
.add("", data)
.set_global_opts(
title_opts=opts.TitleOpts("Scatter3D-基本示例"),
visualmap_opts=opts.VisualMapOpts(range_color=Faker.visual_color),
)
)
return c
Page().add(*[fn() for fn, _ in C.charts]).render()
https://pyecharts.org/#/zh-cn/global_options
这个图上有各个元素的设置,但好像唯独没有中间图形的设置,因为我的图例项目太多,跟图形有重叠,所以我设置图例配置项在整个图形的右边,不过依然有重叠,我想将中间的图形再向左一些,但却没有中间图形的配置项目,更没有pos_left了。请问怎么解决。
例如:https://gallery.pyecharts.org/#/Dataset/dataset_bar_0 的例子
添加.reversal_axis()
报错:
Traceback (most recent call last):
File "d:\python脚本\Dataset - Dataset_bar_0 copy.py", line 5, in
Bar()
File "D:\Python\Python38\lib\site-packages\pyecharts\charts\chart.py", line 189, in reversal_axis
self.options["yAxis"][0]["data"] = self._xaxis_data
AttributeError: 'Bar' object has no attribute '_xaxis_data'
table为啥没有dump_options_with_quotes()方法
许多开源项目,示例代码是可以直接拷过来就能演示,这样也容易提升使用者的兴趣。
pyecharts 的示例代码,不知为什么运行不起来。
以下是formatter 参数的配置方法的说明文档:
# 字符串模板 模板变量有:
# {a}:系列名。
# {b}:数据名。
# {c}:数据值。
# {@xxx}:数据中名为 'xxx' 的维度的值,如 {@product} 表示名为 'product'` 的维度的值。
# {@[n]}:数据中维度 n 的值,如{@[3]}` 表示维度 3 的值,从 0 开始计数。
# 示例:formatter: '{b}: {@score}'
问题: {@xxx} {@[n]} 这两项不知道如何使用!求解答。
pyecharts-gallery/Graph/graph_base.py
Line 5 in ad5fedb
https://github.com/pyecharts/pyecharts-gallery/blob/master/Graph/npm_dependencies.py
API里面graph的coordinateSystem可以设置成‘geo’,请问该用什么形式传值,能否提供个Demo?感谢!
如何给每个关系设置不同的粗细?
Geo() .add_schema(maptype="world_china_provinces",layout_size=1000)
world_china_provinces启用这个地图类型会导致生成的网页被渲染成白屏。
测试了maptype="china","world’都能正常的展示。
我检查了网页的html代码,发现
`
| <meta charset="UTF-8">
| <title>Awesome-pyecharts</title>
| <script type="text/javascript" src="https://assets.pyecharts.org/assets/echarts.min.js"></script>
| <script type="text/javascript" src="https://assets.pyecharts.org/assets/maps/world_china_provinces.js"></script>
|
| </head>
`
这里指向的"https://assets.pyecharts.org/assets/maps/world_china_provinces.js"字符集和https://assets.pyecharts.org/assets/maps/china.js 这个不同。
series_options.LabelOpts
daylabel_opts: Union[LabelOpts, dict, None] = None,
请问要传入啥样的字典??
问题描述
我在使用pyecharts绘制树图的过程中,发现pyecharts绘制出的树图默认只展开0, 1, 2这三层节点,后面更深层的节点是折叠起来的。我希望绘制出的树图初始就能展开所有层级的节点,不要隐藏。
在echarts中有2个参数可以实现这个功能,设置参数initialTreeDepth: -1或者expandAndCollapse: false都可以使各层节点全部展开(见截图)。但pyecharts似乎没有对应的参数。
示例
我运行了您给出的echarts官方示例树图的python代码
https://github.com/pyecharts/pyecharts-gallery/blob/master/Tree/radial_tree.py
也存在不能默认展开多层节点的问题,但您的代码注释中并未说明无法实现此功能。
echarts官方示例树图
https://echarts.baidu.com/examples/editor.html?c=tree-radial
截图中红框标注部分的参数并没有在您的python代码中体现。这里能否向您请教如何修改程序,使之与echarts相对应,可以通过参数控制默认的树图展开层数?
我想可能需要修改pyecharts这个module的一些程序才能解决,但我还没有找到修改的方法。
how can I label every country using other language? for example Chinese.
例如,在给出的散点图实例中,X轴 类型为条目,怎么改成数值型的?想要探究两个变量之间的关系。
add_xaxis() 只能添加条目类型的吗?
通常一个表格除了看,还可以点击进入下一级或详情页面
例如:
echarts.on('click', function (params) {
location.href = `xxx/${categories[params.name]}`;
});
这种点击绑定事件通常在生成html时动态编译完成,但是在文档中没有找到
以后会不会新增甘特图。
绘制的点都无法随着缩放改变,请问有办法绘制能进行自适应变化的图标吗
http://gallery.pyecharts.org/#/Line/rainfall_and_water_flow
At this web page, your test data has an error!
什么星座图 ,调和曲线图,什么的不考虑弄一下吗,这对搞数理统计的同志不友好啊
在測試時發現樹狀圖最多只能有三層,請問可以顯示更多層嗎???
如题,render_notebook() 似乎只有在全局域时图像才会出现。
import pyecharts.options as opts
from pyecharts.charts import Bar3D
coilsys, coil = 'HCFs', 'c'
s_ind = -20
m_, n_ = range(-11, 11 +1), range(-3, 3 +1)
data_ = [[m,n,np.abs(Bcomp_smn[coilsys][coil]['b1_bis'][s_ind,m,n])] for m in m_ for n in n_]
data_max=max([data[2] for data in data_])/3
bar = ( Bar3D() # init_opts=opts.InitOpts(width="1000px", height="500px")
.add(
series_name="",
data=data_,
xaxis3d_opts=opts.Axis3DOpts(type_="category", name='m', data=m_),
yaxis3d_opts=opts.Axis3DOpts(type_="category", name='n', data=n_),
zaxis3d_opts=opts.Axis3DOpts(type_="value"),
grid3d_opts=opts.Grid3DOpts(width=len(m_)*6, height=40, depth=len(n_)*6),
)
.set_global_opts(
visualmap_opts=opts.VisualMapOpts(max_=data_max)
)
)
bar.render_notebook()
这一段代码可以产生这样的图,
但如果我将它打包成函数的话,就会产生下面奇怪的偏移,
from ergospy.visual import RMP
coilsys, coil = 'HCFs', 'c'
s_ind = -5
m_, n_ = range(0, 15 +1),[-3,-2,-1,0, 1,2,3]
bar3D = RMP.spectrum_bar3D(np.abs(Bcomp_smn[coilsys][coil]['b1_bis'][s_ind,:,:]), m_,n_, 1/2)
bar3D.render_notebook()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.