For questions related to labeling plot data points or bar labels.
Questions tagged [plot-annotations]
156 questions
4
votes
2 answers
Python and Remove annotation from figure
I am using matplotlib inside of a wxpython GUI. In short, I have plotted a bunch of data. I then click on a data point (using DataCursor found at:
Is there a matplotlib equivalent of MATLAB's datacursormode?
or
Pop up annotations on matplotlib…

mcfly
- 1,151
- 4
- 33
- 55
3
votes
1 answer
How to add custom annotations with uncertainty to a heatmap
I am attempting to visualize some data as a table, where the boxes of each table element are colored according to their value, the numerical value is also displayed, and the uncertainty on each element is shown. I can achieve 2 out of these 3 things…

Plaetean
- 163
- 2
- 12
3
votes
1 answer
How to annotate grouped bars with percent for each index
I have created a bar plot with the following code. I would like to label the percentages adding up to ~100% for each user, as I've done in MSpaint for user1 and user2 below:
import matplotlib.pyplot as plt
import numpy as np
import pandas as…

Aaron
- 33
- 4
3
votes
0 answers
plotly graph objects persistent data labels when clicking the graph
I'm generating a graph:
import plotly.graph_objects as go
When I click on a data point I get the x,y data as shown, but as soon as I move the mouse pointer to a different data point then the other disappears.
I want to have both points appear on…

magicsword
- 1,179
- 3
- 16
- 26
3
votes
1 answer
How to add text on surfaces of cubes
How to add text on surfaces of cubes. I'm trying to solve 3d packing problem but i have problem visualization because if there were 1000 cubes, how to identify each of them.So i need to write number on surfaces(every surfaces if it is…

LogicLover90
- 229
- 1
- 9
3
votes
1 answer
How to customize bar annotations to not show selected values
I have the following data set:
data = [6.92, 1.78, 0.0, 0.0, 3.5, 8.82, 3.06, 0.0, 0.0, 5.54, -10.8, -6.03, 0.0, 0.0, -6.8, 13.69, 8.61, 9.98, 0.0, 9.42, 4.91, 3.54, 2.62, 5.65, 1.95, 8.91, 11.46, 5.31, 6.93, 6.42]
Is there a way to remove the 0.0…

Tcs106
- 153
- 10
3
votes
2 answers
Add image annotations to boxplot
I would like to add image annotations to a boxplot, akin to what they did with the bar chart in this post:
How can I add images to bars in axes (matplotlib)
My dataframe looks like this:
import pandas as pd
import numpy as np
names = ['PersonA',…

p3hndrx
- 103
- 9
3
votes
1 answer
How to add annotation to vertical line
I made a plot of a time-series and added a vertical line.
This vertical line indicates that something happened and I would like to add an annotation to that vertical line. But I have no idea how to do this :/
Here is the code to plot the data and…

Heiko104
- 31
- 1
- 3
3
votes
2 answers
How to calculate percent by row and annotate 100 percent stacked bars
I need help adding the percent distribution of the total (no decimals) in each section of a stacked bar plot in pandas created from a crosstab in a dataframe.
Here is sample data:
data = {
…

Marie10
- 141
- 3
- 8
3
votes
0 answers
how to plot images instead of dots in a 3d matplotlib figure?
I have a list like this, image for the path of each image file, xyz for the coordination of each image in the 3d figure:
my list
I searched below is a solution for 2D, which works fine, but obviously not working for 3d:
Matplotlib: How to plot…

Shawn
- 31
- 2
3
votes
1 answer
Annotate with marker instead of arrow
How do I take this code:
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
x=[1,2,3,4,5,6,7,8,9,10]
y=[1,1,1,2,10,2,1,1,1,1]
line, = ax.plot(x, y)
ymax = max(y)
xpos = y.index(ymax)
xmax = x[xpos]
arrow =…

Artur Müller Romanov
- 4,417
- 10
- 73
- 132
3
votes
1 answer
Annotation changing the plot?
Usually when I plot some distribution I like to insert auxiliar lines to show extra information, such as mean:
plt.figure(figsize=(15, 5))
h = r1['TAXA_ATUAL_UP'].mean()
plt.axvline(h, color='k', linestyle='dashed', linewidth=2)
print(h) #…

pceccon
- 9,379
- 26
- 82
- 158
3
votes
1 answer
Is there a convenient way to add a scale indicator to a plot in matplotlib?
I want to add a scale indicator to a plot like the one labelled '10kpc' in the (otherwise) empty plot below. So basically, the axis use one unit of measure and I want to indicate a length in the plot in a different unit. It has to have the same…

con-f-use
- 3,772
- 5
- 39
- 60
3
votes
1 answer
Annotating vertical lines below the x-axis with pyplot
With matplotlib, I am trying to annotate vertical lines that I have drawn on a plot of sequential data. With the line
plt.annotate('%.2f' % 2.34, xy=(0,0), xytext=(0,-20), xycoords='axes fraction', textcoords='offset points',color='r')
I am able to…

C. Mahany
- 31
- 1
- 2
3
votes
1 answer
Annotate axis with text in matplotlib
I want to annotate the axis of a plot with text like the example chart. To be specific, I would like to annotate regions of the axes with different captions (XYZ, ABC, MNO, etc. shown in red).
I generated the chart using this example (plotting…

user6057322
- 31
- 1
- 1
- 3