You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can specify vmin_vmax as a slider, and you can individual specify vmin and vmax as functions. But you cannot specify both vmin and vmax using a single function. It would be nice to be able to do something like this (percentile based thresholding)
I think I may have backed myself into a corner here where each controls object can only have a single vmin_vmax. This is because I really want to be able to do ctrls['vmin']
If vmin_vmax is a function then it should be possible to pass different functions to each iplt call.
but if we allow that then there is no easy way to define ctrls['vmin']. I think this is an issue because this is the only dynamically defined kwarg that we have.
Maybe the solution is to create a transformed kwarg object?
frommpl_interactionsimporttransformed_kwarg, Controlsdefvmin_vmax(prange):
# do something complicatedreturn (vmin, vmax)
vv_kwarg=transformed_kwarg('prange', vmin_vmax), # just use signature inspect here?# or maybe have `kwargs=None` which defaults to using signature inspectControls(prange= ('r', 1, 99, 99), vmin_vmax=vv_kwarg) # vmin = transformed_kwarg....
where the vmin = is a default transformation that magically does the right thing
Problem
You can specify
vmin_vmax
as a slider, and you can individual specifyvmin
andvmax
as functions. But you cannot specify bothvmin
andvmax
using a single function. It would be nice to be able to do something like this (percentile based thresholding)and then do
iplt.imshow(img, prange(1,99,99), vmin_vmax=vmin_vmax)
Proposed Solution
Add yet more special casing to
vmin_vmax
to allow this.I think a check if it's a callable goes here: https://github.com/ianhi/mpl-interactions/blob/94cfc2a9d9f3be9091c47bf329ed2e309edbab94/mpl_interactions/controller.py#L110-L112
(and in mpl equivalent) and similarly here:
https://github.com/ianhi/mpl-interactions/blob/94cfc2a9d9f3be9091c47bf329ed2e309edbab94/mpl_interactions/controller.py#L154-L156
This will also require keeping tracking of which params the function accepts and should maintain the ability to access
controls.params['vmin_vmax']
Additional context
The text was updated successfully, but these errors were encountered: