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

[Bug]: RangeSlider.set_val does not move the slider (only poly and value) #22706

Closed
@vpicouet

Description

@vpicouet

Bug summary

When I callRangeSlider.set_val([0.0,0.1])
It changes only the blue poly object and the range value on the right side of the slider not the dot:
Capture d’écran, le 2022-03-25 à 18 00 59

Code for reproduction

importnumpyasnpimportmatplotlib.pyplotaspltfrommatplotlib.widgetsimportRangeSlider# generate a fake imagenp.random.seed(19680801)N=128img=np.random.randn(N,N)fig,axs=plt.subplots(1,2,figsize=(10,5))fig.subplots_adjust(bottom=0.25)im=axs[0].imshow(img)axs[1].hist(img.flatten(),bins='auto')axs[1].set_title('Histogram of pixel intensities')# Create the RangeSliderslider_ax=fig.add_axes([0.20,0.1,0.60,0.03])slider=RangeSlider(slider_ax,"Threshold",img.min(),img.max(),valinit=[0.0,1])# Create the Vertical lines on the histogramlower_limit_line=axs[1].axvline(slider.val[0],color='k')upper_limit_line=axs[1].axvline(slider.val[1],color='k')defupdate(val):# The val passed to a callback by the RangeSlider will# be a tuple of (min, max)# Update the image's colormapim.norm.vmin=val[0]im.norm.vmax=val[1]# Update the position of the vertical lineslower_limit_line.set_xdata([val[0],val[0]])upper_limit_line.set_xdata([val[1],val[1]])# Redraw the figure to ensure it updatesfig.canvas.draw_idle()slider.set_val([0.0,5])slider.on_changed(update)plt.show()

Actual outcome

I does not move the slider
Capture d’écran, le 2022-03-25 à 18 04 26

Expected outcome

It should move the slider

Additional information

No response

Operating system

OSX

Matplotlib Version

3.5.1

Matplotlib Backend

No response

Python version

3.8

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp