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
0
votes
1 answer

Imshow differs drastically from applying matplolib.cm to a segmented image

Hi and thanks for reading. What I am trying to do is to make a web app that would take an image, run it through the model and return a segmented version. I can not use imshow in the webapp though. So I tried adding colormap through…
0
votes
1 answer

How to prevent garbage collection in Python when an interactive plot runs in the background (Python, matplotlib)?

I have a code that uses matplotlib and the Button widget. It all works well, but when this code is written as a function, the buttons stop working. This is because after the function runs, the button objects are being removed by the garbage…
OnY
  • 897
  • 6
  • 12
0
votes
0 answers

MatplotlibDeprecationWarning: drawtype

I want to create a JSON file to use for training my machine learning model to create boundary boxes and it appears to be out of date. This is the error I am getting: The 'drawtype' parameter of __init__() was deprecated in Matplotlib 3.5 and will be…
0
votes
0 answers

Interactive chart - Move a line to the position I need - Python

I need to create interactive chart, on which a line can be slided right/left on x axis while saving new values. Illustration: I have the right red line in the A position but want to move it to B position (orange line) manually and then save position…
0
votes
1 answer

How can I remove the axhline I added with my slider widget

I pulled the below code from SO and modified it to get closer to what I need. Basically, I want the user to move a slider to change the position of the axhline, which then will be used to do come calculations. My issue is that the line which…
higrm
  • 23
  • 4
0
votes
0 answers

How do we add a cursor on an animated plot with matplotlib?

I am trying to build some kind of a game where you have to keep the cursor as close as possible to a line. For this I animated a piecewise function with animation.FuncAnimation and added a crosshair cursor. The problem is that the cursor disappears…
0
votes
1 answer

How to increase Y axis limit on matplotlib?

def doAnchoreGraph(image): print(image) info = infoAnchoreLog(image) window = Toplevel() window.title('Report '+ image) window.geometry("1000x1000") data = {'CVE': ['1. CRITICAL','2. HIGH','3. MEDIUM','4. LOW'], …
0
votes
2 answers

why does global in a class behave differently when the class is within a function?

I'm trying to use ginput to register clicks on a map, and wanted to add action buttons using matplotlib widgets. In the following code, I can pass back the value of action to the main code by declaring it a global. If I click on the map, action=0,…
ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
0
votes
0 answers

Pyplot Button widget hover event is not working

I have the following code. The Button widget is not responding to hover event. What am I doing wrong? from matplotlib import pyplot as plot from matplotlib.widgets import Button plot.plot([1,2,3], [1,2,3]) ax = plot.axes([0.5, 0.5, 0.05,…
Dinesh
  • 1,825
  • 5
  • 31
  • 40
0
votes
2 answers

Pyplot grid is not shown if I add Button widget

I have the following code. The grid is visible without the Button widget. But when the grid is not shown if I add the button. What am I doing wrong? from matplotlib import pyplot as plot from matplotlib.widgets import Button plot.plot([1,2,3],…
Dinesh
  • 1,825
  • 5
  • 31
  • 40
0
votes
1 answer

How do I remove the little red line marking the initial value of the amplitude in my slider?

I am using a matplotlib.widgets slider and it's working perfectly but there is a little red line that marks the initial value of the slider that I would like to remove. I checked the documentation for the Slider function and there was a mention of…
0
votes
1 answer

Matplotlib GUI showing even though I never called plt.show()

I am using the following functions in order... - plt.figure() - plt.plot() - plt.ylim - plt.xticks() - figure = plt.gcf() - figure.set_size_inches() - plt.savefig() I just want to save the figure as png, which I've been doing…
0
votes
0 answers

How to place widgets' axes with equal aspect and requested size?

I wanted the sizes of radion button axes proportional to the number of radio buttons options (30, 20 and 10 in my example), like on my "without 'equal'" screenshot and round radiobutton circles, like on my "with 'equal'" screenshot. How do I get…
Yulia V
  • 3,507
  • 10
  • 31
  • 64
0
votes
1 answer

Unable to Update the suptitle string with text value

I am trying to putdown the strign value from the text field to the string in the mplwidget suptitle but it is not working. te = (self.a1.text()) self.MplWidget.canvas.figure.suptitle("Thermo Physical Properties of "+te)
0
votes
1 answer

Change axis range using matplotlib.widgets.Button

I have a plot in which the x axis contains datetime.datetime objects. I am trying to change the range of the x axis with multiple matplotlib.widgets.Buttons. One button shows all datetimes, while another button shows only the last two seconds. When…
Erdrick
  • 87
  • 1
  • 4