Questions tagged [matplotlib-widget]

matplotlib.widgets provide a simple mechanism for interactive, GUI style plots using matplotlib.

From the matplotlib.widgets page

GUI Neutral widgets

Widgets that are designed to work for any of the GUI backends. All of these widgets require you to predefine matplotlib.axes.Axes instance and pass that as the first argument. Matplotlib doesn’t try to be too smart with respect to layout – you will have to figure out how wide and tall you want your Axes object to be to accommodate your widget.

There are many useful examples including:

215 questions
2
votes
1 answer

matplotlib, plt.show() in a different method = no on_clicked

When I put plt.show() in a different method, it's impossible to click the button : import matplotlib.pyplot as plt from matplotlib.widgets import Button class ButtonTest: def __init__(self): ax = plt.axes([0.81, 0.05, 0.1, 0.075]) …
Luc PHAN
  • 316
  • 2
  • 13
2
votes
2 answers

Link two matplotlib sliders together

I'm writing a script using matplotlib in which I have two sliders that can move the plot left and right. I want to make it so that if I move one slider, the other slider is also updated. I thought I could use the Slider.set_val(val) method for this,…
Maaike
  • 122
  • 9
1
vote
1 answer

Question about format of return values of pythons matplotlib.pyplot SpanSelector

I am trying to select a range of data in a matplotlib plot and got stuck with the return values of SpanSelector: from io import StringIO import matplotlib.pyplot as plt from matplotlib.widgets import SpanSelector import numpy as np import pandas as…
nohtyp
  • 11
  • 2
1
vote
0 answers

Network graph In Matplotlib?

I had a question about python matplotlib I wanted to know in this library Is it possible to make grid diagrams in which circles are drawn and connected and intersected by lines? In the network graphs that I saw, the circles are divided like cells,…
1
vote
1 answer

Matplotlib changing underlying data for scatter plot with widget buttons

I have a plot in which I want to plot the following two data sets x1,y1 = np.random.normal(0,1, (2,20)) # dataset 1 x2,y2 = np.random.normal(0,1, (2,20)) # Next, I create a plot and the PathCollection from the scatter fig, ax = plt.subplots() ax =…
1
vote
0 answers

Visual Studio Code Jupyter Notebook matplotlib WIDGETS OUTPUT CELL background colour change

LTDR: I want the fourth image to look like the second image. When using Visual Studio Code and Jupyter Notebook, if I use Matplotlib widgets, the colour of the output cell background is white. This is very inconvenient. This issue is not present…
1
vote
0 answers

Matplotlib button doesn't respond until moving cursor

I have som problems with buttons/animations in matplotlib. I'm trying to make an animation that starts when the button "start" is clicked on and stop when "stop" is clicked on. The problem is that the animation does not start when I click the…
1
vote
1 answer

Matplotlib backend notebook customizations

I'm using the matplotlib backend 'notebook', because I am making some interactive figures, and this works well with the notebook backend (in particular, I serve them via Jupyter Notebooks). I use ipywidgets to design the GUI and…
1
vote
1 answer

Set tick labels for matplotlib Slider widgets

The slider behavior in matplotlib has changed with recent updates. With the following code: import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Slider fig = plt.figure(figsize=(8, 4)) ax_main = plt.axes([0.15, 0.3,…
Mr. T
  • 11,960
  • 10
  • 32
  • 54
1
vote
1 answer

Call fuction from matplotlib-button in Python

I would like to call a function by pressing a matplotlib-button. Right now, following approach works: Run script Press start-button in diagram window => cond=True execute function in console by typing: plot_data() The code looks similar to…
gerban
  • 11
  • 1
1
vote
1 answer

How can I change the python matplotlib.pyplot legend marker into a serial number like 1,2,3 instead of shape or character?

import matplotlib.pyplot plt.figure() plt.plot(x, 'r+', label='one') plt.plot(x1, 'go--', label ='two') plt.plot(y, 'ro', label='Three') plt.legend() In the above code legend marker is 'r+' , 'go--' and 'ro' but I want it to change into 1,2 and 3…
1
vote
0 answers

How to change the displayed value of a slider in the matplotlib GUI?

I am building a GUI with matplotlib, and have two sliders which are used to set time values in unix/epoch time. However, this format isn't human-readable, and I would like it to be displayed in [%Y-%m-%d %H:%M] format. Here's a screenshot of the…
1
vote
0 answers

How can i zoom within a 3d plot in matplotlib using ipympl and jupyter notebooks?

I can zoom when i use a 2d plot using the area selection tool with the mouse on the plot, but when i want to do the same on a 3d plot, the 3d plot is rotated. Is this not possible in 3d mode or do i just use the wrong mouse button / keys? I used the…
Joysn
  • 987
  • 1
  • 16
  • 30
1
vote
0 answers

Python Plotting issues : Clear

I've been running into a problem for several days, The program allows you to retrieve data, create one, and display it on a Figure. I did it this way because we can display 2 curves or 3 curves no matter what we press the button and presto it is…
1
vote
1 answer

Python - matplotlib: how to change RectangleSelector properties

Is it possible to change RectangleSelector properties after it has been created? Let's say I created a figure with the following rectangle: from matplotlib.widgets import RectangleSelector import matplotlib.pyplot as plt def on_click(eclick,…
Tommaso
  • 89
  • 2
  • 11