python-3.x - 错误无穷大值 altair jupyter [-infinite,infinite]
问题描述
大家好,我在 altair 上创建图表时遇到问题。该图可以毫无问题地工作,唯一的缺点是当我要与之交互时,我会获得以下标签。我要解决的另一件事是,我希望系统需要在机器人案例中做出反应,因此当我与第一个下拉菜单交互时,以及当我与第二个或两者交互时。当且仅当我用“transform_filter((selection | selection1))”替换“transform_filter((selection & selection1))”时,所有这些问题都不会出现,但万一我做了这个替换并且我想要根据两个过滤器过滤元素是行不通的。
Infinite extent for field "timestamp": [Infinity, -Infinity] Infinite extent for field "Y1": [Infinity, -Infinity]
input_dropdown = alt.binding_select(options=[[1,2,3,4,5],[4],[3],[1],[2],[5],[1,4,5],[3,4,5],[1,2,3,4],[1,3,5],[1,3,4],[1,2,5],[1,2,4],[1,2,3],[4,5],[4,2],[2,3],[1,2],[5,3],[3,4],[2,5],[1,4],[1,5],[1,2],[1,3]])
selection = alt.selection_single(fields=['FIELD1'], bind=input_dropdown, name='FIELD1: ')
#dropdown
input_dropdown1 = alt.binding_select(options=[['M13','M14','M15','M16'],['M14'],['M13'],['M16'],['M15']])
selection1 = alt.selection_single(fields=['FIELD2'], bind=input_dropdown1, name='FIELD2: ')
#shape
selection_Operation= alt.selection_multi(fields=['FIELD1:N'],bind='legend')
shape_Operation = alt.condition(selection_Operation ,alt.Shape('FIELD1:N'), alt.value('lightgray'))
color = alt.condition(selection,alt.Color('FIELD2:N'), alt.value('lightgray'))
interaction1 = alt.selection_interval(bind='scales', on="[mousedown[event.altKey], mouseup] > mousemove", translate="[mousedown[event.altKey], mouseup] > mousemove!",
zoom="wheel![event.altKey]"
)
interactionY = alt.selection_interval(bind='scales', encodings=['x'],on="[mousedown[event.shiftKey], mouseup] > mousemove",translate="[mousedown[event.shiftKey], mouseup] > mousemove!",
zoom="wheel![event.shiftKey]")
Scatter=alt.Chart(pd_df_).mark_point(filled=True).encode(x=alt.X('timestamp:T', title='TIMESTAMP'),y=alt.Y('Y1:Q', title='Y1'), color=color,shape=shape_Operation,tooltip = ['Y1:N','FIELD1:N','KIND:N','FIELD2:N', alt.Tooltip('timestamp:T', format = '%Y-%m-%d %H:%M'),'CODE:N']
).add_selection(interaction1,interactionY,selection,selection1,selection_Operation).transform_filter((selection & selection1))
ScatterLine
#saveVegaLiteVis(es, 'index-pattern', 'graph1', ScatterLine, timeField=True)
解决方案
推荐阅读
- c# - 验证 MVC 应用程序会导致 OpenID Connect 3 的无限重定向循环
- python - 如何在 matplotlib 中创建带有温度符号的刻度 - °C -
- python - 如何将 DataFrame 与其他 DataFrame 的列进行比较?
- windows - 在 git 中调用 sublime 编辑器
- python - Python - JSON 数组到 DataFrame
- android - 使用 retrofit2 发送 POST
- corda - Corda 从一个流执行多个流
- c - 在 C 中保存每秒索引值的结构
- python - 无法将类定义放入函数
- android-studio - 我的颤振项目在 android studio 中缺少 Gradle 窗口