散景,仅在单个轴上缩放,然后相应地调整另一个轴 [英] Bokeh, zoom only on single axis, adjust another axis accordingly
问题描述
如何使bokeh仅在一个轴上使用缩放并自动缩放对象,以使它们恰好占用给定的空间并在可缩放的轴平行线的极端点上添加一些填充,同时将超出范围的空白空间渲染? >
换句话说(或确切地说是疯狂技能"): 示例图.
这是最广泛用于股票绘图的,因此请考虑我要复制解决方案
仅使用"xwheel_zoom"工具在X轴上进行缩放:
from bokeh.plotting import figure
fig = figure(tools='xwheel_zoom', active_scroll='xwheel_zoom')
每当第一个(Y)轴发生变化时,就通过调用自定义JavaScript事件来自动缩放另一个(Y)轴.在这种情况下,您将浏览可见数据并修改轴范围.就像下面的要点示例一样: https://gist.github.com/kernc/719918ada11298168efd956afc1a04a8
How can one make bokeh use zoom only on one axis and automatically scale objects, so they take exactly the space given and add some padding on extreme points off zoom-able axis parallels, while rendering empty space out of scope?
In other words (or "madskills" to be exact): Example plot.
This is most widely used for stocks plotting, so consider I want to copy zoom behavior of https://www.tradingview.com/chart/?symbol=FX:XAUUSD with Bokeh. Thank you in advance.
Zoom on X axis only by using 'xwheel_zoom' tool:
from bokeh.plotting import figure
fig = figure(tools='xwheel_zoom', active_scroll='xwheel_zoom')
Auto-scale the other (Y) axis by invoking a custom JavaScript event whenever the first axis changes. In this event, you scan through the visible data and amend the axis range. Like in the following gist example: https://gist.github.com/kernc/719918ada11298168efd956afc1a04a8
这篇关于散景,仅在单个轴上缩放,然后相应地调整另一个轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!