Questions tagged [mplcursors]

For questions pertaining to mplcursors, which provides interactive data selection cursors for matplotlib≥3.1 in python3

74 questions
241
votes
12 answers

How to add hovering annotations to a plot

I am using matplotlib to make scatter plots. Each point on the scatter plot is associated with a named object. I would like to be able to see the name of an object when I hover my cursor over the point on the scatter plot associated with that…
jdmcbr
  • 5,964
  • 6
  • 28
  • 38
4
votes
2 answers

how to make the mplcursors module only show labels for points plotted on a line graph

So I have a line graph where the mplcursors module in python shows the coordinates for any point on it. I want it to only show labels for points that are explicitly plotted, not the ones that are in-between the plotted points and happen to be on the…
3
votes
1 answer

Scope in Python subplot similar to MATLAB's stackedplot()

Is there a plot function available in Python that is same as MATLAB's stackedplot()? stackedplot() in MATLAB can line plot several variables with the same X axis and are stacked vertically. Additionally, there is a scope in this plot that shows the…
AGN
  • 33
  • 5
3
votes
1 answer

How to add tooltips to a confusion matrix rendered via a Seaborn heatmap?

How can I make my mat plot lib interactive? For example, when I hover the mouse over each cell of a confusion matrix, I'd like to display the instance of that prediction. confusion_mat_df = pd.DataFrame(confusion_mat,columns = pred_spectrum, index =…
yishairasowsky
  • 741
  • 1
  • 7
  • 21
3
votes
1 answer

How to use two mplcursors simultaneously for a scatter plot of two sets?

I am trying to get a scatter plot of 2 different variables, one set of scatter points is height values for a projectile under the effect of air resistant, and one is a projectile with no air resistance. I can get this working with 1 set of…
user11383585
3
votes
1 answer

show label on hover over vertically spanned area

when I hover over spanned region, labels are being showed only along the sides of spanned area but not through out the area. I want the label to be viewed in the whole area when I hover in it. How can I implement this logic? import…
vaasu varma
  • 85
  • 1
  • 7
2
votes
1 answer

How to use mplcursors to annotate with a complete dataframe row in a multigrid plot

I'm trying to plot a multi-dimensional scatterplot across several visual properties (facets, hue, shape, x, y). I'm also trying to get a tooltip on cursor hover to show additional properties of the point. (I'm using seaborn + mplcursors, but I'm not…
diyer0001
  • 33
  • 4
2
votes
1 answer

How to add entire dataframe row as scatter plot annotation

I'm plotting two columns of a Pandas DataFrame on a scatterplot and I want each point to show all the row values of the DataFrame. I've looked at this post, and tried to do something similar with mplcursors: import pandas as pd from datetime import…
2
votes
1 answer

How to annotate with multiple columns using mplcursors

Below is code for a scatter plot annotated using mplcursors which uses two columns, labeling the points by a third column. How can two values from two columns from a single dataframe be selected for annotation text in a single text box? When instead…
2
votes
1 answer

Add the vertical line to the hoverbox (see pictures)

I'm making a program to quickly analyze testing curves of battery chargers and such. I would like to combine the hoverbox, which snaps to each curve with a vertical line for easy comparison. If I activate both codes, they collide and I get a line…
Slangfil
  • 23
  • 6
2
votes
1 answer

Using mplcursors with more than one dataframe

from matplotlib import pyplot as plt import mplcursors from pandas import DataFrame df = DataFrame( [("Alice", 163, 54), ("Bob", 174, 67), ("Charlie", 177, 73), ("Diane", 168, 57)], columns=["name", "height",…
darthV
  • 355
  • 1
  • 3
  • 16
1
vote
1 answer

AttributeError occurs when clicking with mplcursors

My code to plot and have labeled lines when I hover them keeps getting an error when click on the canvas. I even tried using the basic example from the mplcursors webpage and the same behavior is apparent. If you're going to run the code to see, you…
Paul K.
  • 13
  • 3
1
vote
1 answer

Tkinter click event error after third click

I have created this very simple code that generates a message depending if I single or double click on a bar on a barplot. What I don't understand is why it works for the first two times and the third time that click anywhere it generates an…
1
vote
1 answer

Print dataset from box in barplot

I have created a bar plot from a dataset, which has stacked bars of different values. What I want is that when I click on a box of a bar, to print the dataset that this box is coming from, not the whole dataset. For example in this code import…
1
vote
1 answer

Seaborn Swarmplot "hue" not coloring correctly / as expected

When I graph my data with Seaborn swarmplot, it orders the overlapping points "middle out". Meaning, the larger levels are in the middle and the smaller are on the edges (like 1,1,2,2,1,1 or 2,2,3,4,2,2). This messes up the hue coloration as…
Michael S.
  • 3,050
  • 4
  • 19
  • 34
1
2 3 4 5