如何在多个全息图中链接轴? [英] How to link the axis in multiple holoviews plots?

查看:59
本文介绍了如何在多个全息图中链接轴?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用全息视图创建了数据着色器图:

I have created to datashader plots with holoviews:

datashade(hv.Points(df[
    [
        'PS Engine-% Load', 
        'PS Engine-Fuel Rate',
    ]
])) + datashade(hv.Points(df[
    [
        'SB Engine-% Load', 
        'SB Engine-Fuel Rate',
    ]
]))

两个图都绘制得很好,现在我想链接轴的范围,所以当我放大一个图时,另一个图也以相同的方式放大.据我所知,当源值相同时,通常轴是链接的.在这种情况下,X 轴和 Y 轴的来源不同(注意 PS 和 SB 值),但范围相同.如何链接这些轴?

Both graphs are plotted fine, now I want to link the ranges of the axis so when I zoom in one graph the other graph is also zoomed in the same way. From what I understand normally axis are linked when the source values are the same. In this case the sources for both the X and Y axis are different (note the PS and SB values) but the ranges are the same. How can I link these axis?

推荐答案

是的,HoloViews 会自动链接它认为相同"的维度,其中相同"归结为具有相同的名称和单位.在这种情况下,最简单的方法可能是确保要链接的维度在数据框中具有相同的列名:

Yes, HoloViews will automatically link dimensions that it considers to be "the same", where "the same" comes down to having the same name and unit. In this case, probably the easiest thing to do is to make sure the dimensions you want to link have the same column name in the dataframe:

df_ps = df.rename(columns={'PS Engine-% Load': '% Load'})
df_sb = df.rename(columns={'SB Engine-% Load': '% Load'})
datashade(hv.Points(df_ps[['% Load','PS Engine-Fuel Rate']])) + \
datashade(hv.Points(df_sb[['% Load','SB Engine-Fuel Rate']]))

如果 Fuel Rate 也应该被链接,只需将其添加到每个的重命名字典中.缩放前的示例:

If the Fuel Rate should also be linked, just add that to the rename dictionary for each one as well. Example before zooming:

放大后:

这篇关于如何在多个全息图中链接轴?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆