215 questions
2
votes
1
answer
2k
views
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(...
1
vote
1
answer
1k
views
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 ...
2
votes
1
answer
1k
views
Updating the y data of plt.fill_between()
So, I'd like to set the 2 y data of a fillbetween object, equivalent to setting the (1) y data of a Line2D with some_line.set_ydata(new_y).
A naïve attempt results in this error:
AttributeError: '...
2
votes
1
answer
2k
views
jupyter notebook - matplotlib shows figure even without calling plt.show()
The following is a simplified example of my code. The idea behind this class is to show the figure only when the show method is executed.
# my_module.py
import matplotlib.pyplot as plt
import numpy as ...
0
votes
1
answer
166
views
Slider is unresponsive when figure contains two plots
Python 3.9, matplotlib 3.4, Mac OS 11.6.1
I have a slider on a tkinter Toplevel containing a figure convas showing two sets of axes. As the slider advances, the axes illustrate the heatplots over time ...
0
votes
1
answer
1k
views
How to pass additional arguments when updating a matplotlib widget
I have multiple similar Sliders, and want to call the function update with a certain argument when a the corresponding slider is changed. Passing additional parameters should work similarly to other ...
0
votes
1
answer
62
views
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 ...
0
votes
1
answer
375
views
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 ...
0
votes
0
answers
1k
views
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 ...
1
vote
1
answer
368
views
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--'...
0
votes
0
answers
233
views
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 ...
3
votes
0
answers
792
views
update Seaborn FacetGrid with a slider widget
I'm trying to dynamically update a figure created using FacetGrid. I made a custom plotting function (plot_heatmap_w_scatter), in which I want to add a correction factor to the scatter function inside....
0
votes
1
answer
736
views
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 ...
0
votes
0
answers
305
views
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 ...
0
votes
1
answer
174
views
How to increase Y axis limit on matplotlib? [duplicate]
def doAnchoreGraph(image):
print(image)
info = infoAnchoreLog(image)
window = Toplevel()
window.title('Report '+ image)
window.geometry("1000x1000")
data = {'CVE': ['...
2
votes
0
answers
208
views
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-...
0
votes
2
answers
65
views
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 ...
0
votes
0
answers
226
views
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,...
0
votes
2
answers
165
views
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 ...
2
votes
0
answers
300
views
Plotting interactive images with python matplotlib
Basically, I want to plot images using matplotlib such that I want to control them actively.
I have looked at this link, but it does not seem to quite answer the question.
I have written a program ...
3
votes
2
answers
4k
views
matplotlib widget disappears after first use
I'm trying once more to use interactive matplotlib plots in Jupyter Notebooks for my students. My plan is to use JupyterLab as the plain Notebook interface is not very well liked among students. Here ...
1
vote
0
answers
262
views
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 ...
0
votes
1
answer
362
views
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 ...
3
votes
0
answers
331
views
Export JupyterLab 3.* with %matplotlib widgets to html
I'm running into an issue with exporting my notebooks from Jupyter Lab. I work with 3D figures and want to export the entire notebook as HTML with images in the current state. I was able to do so in ...
0
votes
1
answer
667
views
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 ...
0
votes
0
answers
99
views
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 ...
1
vote
1
answer
1k
views
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 ...
3
votes
1
answer
2k
views
How to make Matplotlib widget faster?
I am using Matplotlib widget slider on a figure having many plots. When I move the slider it takes about 5 s to update the figure and that is my problem.
After troubleshooting the problem, it seems ...
1
vote
2
answers
4k
views
Add a Matplotlib Graph to a Widget in KivyMD
I am currently creating a mobile app with KivyMD which serves for managing travel expense requests. The user will enter a desired requested amount for different types of expenses on an MDTextField. I ...
3
votes
2
answers
660
views
How to set the min and max value for SpanSelector widget programmatically
I want to update subplots based on a SpanSelector which works as expected. But another requirement is that I need to initialize the selected span to some given values. I have tried to call the _press, ...
2
votes
2
answers
2k
views
Plotting a interactive plot using dropdown and matplotlib
Consider the excel file as given:
I want to plot an interactive line plot using the Normalize_Nifty Values for a particular date based on a particular symbol. For this I am using the ipywidgets. I ...
2
votes
1
answer
385
views
Matplotlib: mouse outside of slider axes continues to change plot
I have a simple script that plots data in x- and y-, and have two scrollbars. One scrollbar lets you scroll through the data in x. The second scrollbar lets you change the range of x values you see at ...
1
vote
2
answers
2k
views
How to use slider.on_changed() within a class in Tkinter in Python
I'm trying to use a horizontal slider to change the xlim of my plot. But first, I can't figure out how to get the slider to update using the on_changed() method. I don't have a strong understanding of ...
0
votes
1
answer
28
views
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 ...
1
vote
1
answer
506
views
Matplotlib: How to plot points on my graph instead of painting them on a button?
Edit: ax.scatter(event.xdata, event.ydata) works fine, IDK how I went past this. However, pressing the button is still paint dots and I'm wondering if filtering coordinates is good practice to solve ...
0
votes
1
answer
518
views
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 ...
0
votes
1
answer
251
views
After I convert my script to executable file, it gives this error : MatplotlibDeprecationWarning
I have an error which's complete form is
MatplotlibDeprecationWarning: The MATPLOTLIBDATA environment variable was deprecated in Matplotlib 3.1 and will be removed in 3.3
I converted my script into ...
0
votes
0
answers
135
views
Struggling to get widgets working in python
I don't know why but I am really struggling to get widgets working well in python. I try to look at examples about how to use them but I don't know how to extrapolate that to get it to work with my ...
1
vote
2
answers
11k
views
Interactive matplotlib plot in PySimpleGUI
I'm trying to get the RectangleSelector form matplotlib.widgets to work with PySimpleGUI.
I'm basing my test code on the RectangleSelector demo shown in the accepted answer on this question.
I'm ...
2
votes
0
answers
3k
views
How to update an imshow inside a ipywidgets layout?
Problem
I want to display a slider linked to a Play button from ipywidgets and then update an imshow plot from matplotlib. However I want the image to stay there and only draw the artists that changed ...
1
vote
1
answer
363
views
How to set Matplotlib RadioButton radius using set_radius?
I try to set RadioButtons circle radius. According to the below MWE, the buttons disappeared. However, removing the circ.set_radius(10) recovers the buttons. Using circ.height and circ.width recovers ...
1
vote
1
answer
1k
views
How to make class for onclick(event) functions for Interactive plot in matplotlib?
I have tried to create an interactive matplotlib plot using some functions. I want to group the functions into one class (I am still new to this, took help from someone else's code)
import matplotlib....
1
vote
0
answers
244
views
Why matplotlib creates a new bar every time updating the image array
I want to display greyscale images with pyqt5 GUI and update the image display continuously, but the matplotlib creates a new colorbar every time updating the display.
Below are the codes.
from PyQt5....
0
votes
2
answers
727
views
matplotlib FuncAnimation won't start on button press widget event
matplotlib noob here.
I am trying to create an animation (which starts on a button click) of a normal distribution being populated, where the distribution parameters (mean and std dev) are selected ...
0
votes
3
answers
748
views
Matplotlib MultiCursor is not displaying on multiple subplots
I have a Matplotlib plot with 6 adjacent, vertical plots, all with sharey=True. When I move the cursor on any one plot, I want a horizontal cursor/marker to show on the other 5. I understand ...
0
votes
2
answers
925
views
Why isn't FuncAnimation repeating when I'm put repeat = True as a parameter?
import matplotlib.image as mpimg
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.widgets import Button
from matplotlib.widgets import Slider
...
0
votes
0
answers
36
views
Is it possible to have 1 matplotlib slider control 2 different matplotlib animations?
If anyone has any experience doing this, please let me know as I would greatly appreciate it.
0
votes
0
answers
613
views
Matplotlib figure and axis background color
I want to remove(red and blue) or set as transparent the color of axis and figure (such as below image). How could I do this? like set_facecolor('transparent') is not working
here is my code:
self....
0
votes
0
answers
293
views
Plot blocking issue for interactive plot using matplotlib.widgets
I'm writing a code which plots raw data from an experiment and I'm trying to manipulate a regression in that plot using matplotlib.widget with the Slider widget. The widget changes a fitting parameter ...
0
votes
1
answer
169
views
matplotlib scatter animation in jupyterlab vanishes after initial frame
I'm have a JupyterLab notebook (v1.1.4) in which I'm trying to animate a scatter plot. I tried using the raindrops example from the matplotlib examples, and it runs fine, but I can't get mine to work.
...