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
3
votes
2 answers

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, _release functions but they just return False…
KIC
  • 5,887
  • 7
  • 58
  • 98
3
votes
1 answer

Transparent NavigationBar in Matplotlib (or, can the Navigation buttonsbe added without a bar?)

I'm trying to maximise use of space in a Qt GUI with an embedded matplotlib figure, including the standard matplotlib navigation bar to provide useful functionality for the user (zoom, save, move etc.) Unfortunately, the NavigationBar ends up taking…
PhysLQ
  • 149
  • 2
  • 9
3
votes
2 answers

How to change the text size in a matplotlib Button?

I have a button in matplotlib, i.e. myButton = Button(axpos, 'This is a button') How do I make the text inside the button smaller?
Frick Steves
  • 365
  • 4
  • 11
3
votes
1 answer

How do I get narrow width and a large height on a RadioButtons widget, and still have round radio buttons that don't overlap?

How do I get narrow width and a large height on a RadioButtons widget, and still have round radio buttons that don't overlap? plt.figure() rax = plt.axes([0.1, 0.1, 0.6, 0.6], frameon=True ,aspect='equal') labels = [str(i) for i in range(10)] radios…
evianpring
  • 3,316
  • 1
  • 25
  • 54
3
votes
1 answer

Interactive bar plot using matplotlib with annotation change

I'm trying to create a horizontal bar plot that can dynamically change with a slider. I've followed the recipe on the matplotib website and it works well for line data. The code: def interactive_pyramid(ages_matrix, year_labels): fig, axs =…
DeanLa
  • 1,871
  • 3
  • 21
  • 37
2
votes
2 answers

Matplotlib sliders on multiple figures

I am writing a Python tool that needs several figures open at the same time, each one with its own widgets (sliders, for the most part). I don't need any interactions across the figures here. Each figure is independent of the other ones, with its…
fbcp
  • 33
  • 6
2
votes
1 answer

Maplotlib figure not show in vscode jupyter notebook

The matplotlib figure suddenly doesn't display in vscode's jupyter notebook environment, even though I used: %matplotlib inline When I plot a figure, e.g.: data = np.random.randn(1000, 2) fig, ax = plt.subplots() ax.scatter(data[:, 0], data[:,…
2
votes
0 answers

How to highlight the bar with a border when moving the mouse over it in the bar chart

I'm still a beginner and I'm trying to make the edge of the bar of the chart be highlighted (change color) in a mouse movement event when hovering over it. Only the bar over which the mouse hovers should be highlighted. The code shows an error:…
MJAGO
  • 35
  • 5
2
votes
0 answers

How do I make multiple span selectors work on the same axis in Matplotlib?

As the title suggests, I am trying to put multiple SpanSelector widgets on the same axis. In the test code below (adapted from this example), I am using a multi-plot figure with the qt backend, to zoom in on the two regions selected by the span…
aparajito
  • 83
  • 7
2
votes
1 answer

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: 'PolyCollection' object has no attribute 'set_ydata'.…
Andre
  • 760
  • 3
  • 13
2
votes
1 answer

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 np class Test: def __init__(self): …
Davide_sd
  • 10,578
  • 3
  • 18
  • 30
2
votes
0 answers

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. Without the slider it works alright, but when I…
2
votes
0 answers

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 which applies Canny's algorithm (an image-processing…
2
votes
2 answers

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 is a two-cell MWE notebook: import numpy as…
2
votes
2 answers

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 have successfully created a dropdown containing a…
Huzefa Sadikot
  • 561
  • 1
  • 7
  • 22
1
2
3
14 15