def link_x_to_y(view1, view2): sync_xy0 = keep_in_sync(view1.state, 'x_min', view2.state, 'y_min') sync_xy1 = keep_in_sync(view1.state, 'x_max', view2.state, 'y_max') return sync_xy0, sync_xy1 def link_y_to_x(view1, view2): ync_yx0 = keep_in_sync(view1.state, 'y_min', view2.state, 'x_min') ync_yx1 = keep_in_sync(view1.state, 'y_max', view2.state, 'x_max') return sync_yx0, sync_yx1 # To keep sync active, need to hold a reference to the link sync objects. # Probably should move this into a _pyxlma_state dict so we only add one thing # to the app. app._x_sync = link_x(views['xy'], views['xz']) app._y_sync = link_y(views['xy'], views['zy']) app._zt_sync = link_y(views['xz'], views['tz']) app._zy_sync = link_x_to_y(views['zy'], views['tz']) # Because of sync this updates all axes. Doesn't work with interactive zoom!? views['tz'].state.y_min = 0.0 views['tz'].state.y_max = 20000.0 # programmatically create a subset # def subset_from_axes_limits(subset): # selection = (data.id['time'] > 6) & (data.id['time'] < 18) # all_points = (lma.id['time'] > 0)