Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[ENH]: More generic slider #26395

Open
Open
@VRehnberg

Description

@VRehnberg

Problem

I've found the current implementation of slider to be quite limited in what you can do. Quite often I don't want a scaler with a linear behaviour but rather with log scale or something even more exotic.

My typical work around is to have vmin and vmax transformed to a linear scale and then call the inverse of this transform in the update function that uses the values from my sliders and sets a new custom text withself.valtxt.set_text.

However, having to this kind of transform inverse combination for each slider and usage of slider is rather anoying and can easily lead to mistakes.

Some other people with similar use cases:

Proposed solution

I imagine that you could create a classNormSlider that additionally takes in a keyword argumentnorm: mpl.colors.Normalize to deal with the this. Then it is a matter of callingnorm(val) andnorm.inverse(scale_val) inside this class instead of having to keep track of it outside the Slider class.

It would still be limited to monotonic transformations as far as I can tell, but it is atleast as general as using

norm = mpl.colors.FuncNorm((_forward, _inverse), vmin=vmin, vmax=vmax)

Other solutions I can think of would be to have aSequenceSlider which would take an argumentvals: Sequence instead ofvalmin,valmax andvalstep. Then the slider would be indexing the values in this array instead. This is arguably as general as you can get.

I'm not sure which one would be better.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp