For questions related to labeling plot data points or bar labels.
Questions tagged [plot-annotations]
156 questions
6
votes
1 answer
3D Scatter Plot with Images as Annotations
I am trying to generate a 3D scatter plot for tSNE embeddings of images from a dataset containing digits from 0 to 9. I would also like to annotate the points with the images from the dataset.
After going through existing resources pertaining the…

Love
- 315
- 1
- 5
- 9
6
votes
2 answers
text boxes automatic position
I would like to position a text box with keyword arguments like those used with legend 'loc' option, i.e. 'upper left', 'upper right', 'lower right', 'lower left'.
The basic purpose is to align the text box with legend.
I found a suggestion here :…

user1850133
- 2,833
- 9
- 29
- 39
6
votes
2 answers
How to show annotations with mouse hover
I am currently employing this code to have pop up annotatations on a map when i click on a point in a Basemap Matplotlib Plot.
dcc =…

mcfly
- 1,151
- 4
- 33
- 55
5
votes
1 answer
How to horizontally center a bar plot annotation
I am creating a bar chart like this:
gender = ['M', 'F']
numbers = [males,females]
bars = plt.bar(gender, numbers, width=0.1, bottom=None, align='center', data=None)
for i in range(len(numbers)):
plt.annotate(str(numbers[i]),…
user12541823
5
votes
2 answers
Auto place annotation bubble
I have the following snippit of code:
data.plot(y='Close', ax = ax)
newdates = exceptthursday.loc[start:end]
for anotate in (newdates.index + BDay()).strftime('%Y-%m-%d'):
ax.annotate('holliday', xy=(anotate, data['Close'].loc[anotate]), …

Slartibartfast
- 1,058
- 4
- 26
- 60
5
votes
3 answers
Annotate values for stacked horizontal bar plot
I'm trying to annotate the values for a stacked horizontal bar graph created using pandas. Current code is below
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
d = {'group 1': [1, 2, 5, 7, 4, 5, 10],
'group 2': [5, 6,…

at1623
- 129
- 9
5
votes
1 answer
Displaying a line of text outside of a plot
I have a matrix plot produced by the matplotlib library. The size of my matrix is 256x256, and I already have a legend and a colorbar with proper ticks. I cannot attach any image due to my being new to stackoverflow. Anyhow, I use this code to…

FaCoffee
- 7,609
- 28
- 99
- 174
4
votes
1 answer
Align text in the center of the bounding box
I'm trying to create some labels manually which should align exactly with the tick locations. However, when plotting text ha='center' aligns the bounding box of the text in the center, but the text itself within the bounding box is shifted to the…

Wouter
- 3,201
- 6
- 17
4
votes
2 answers
How to annotate countplot with percentages by category
Hi I'm trying to add percentages to my countplot with 5 categories and 2 values (old and younger). I've tried adding the def and loop from
How to add percentages on top of bars in seaborn?
My code:
plt.figure(figsize =(7,5))
ax = sb.countplot(data =…

Lee Zowers
- 43
- 1
- 3
4
votes
1 answer
Matplotlib: Annotate plot with vertical arrow and centered text
I would like to annotate a plot with a vertical arrow, and then center the annotation on the tip of the vertical arrow:
Here is the code that I use:
import matplotlib.pyplot as plt
plt.annotate(
# Label and coordinate
'Help here!', xy=(8,…

Fringant
- 525
- 1
- 5
- 17
4
votes
1 answer
xytext details in Matplotlibs Annotate
With the following code I am plotting a candlestick graph and also make use of annotations. I have played arround until I found the right positions for the text, but I still don't understand what the figures xytext=(-15, -27) and xytext=(-17, 20)…

sunwarr10r
- 4,420
- 8
- 54
- 109
4
votes
1 answer
Python PieChart (is it possible to do CallOut labels)
Is there any examples of doing CallOut Labels with Python, Matplotlib etc
Image source
Something like above with a line and the label pointing from outside the pie chart.. cannot see any possible examples of it being done with Mathplotlib.... can…

iHaag
- 65
- 2
- 10
4
votes
1 answer
Annotation auto-placement in a plot
I have code that handles coloring and plotting multiple plots automatically easily (for me). I want to make annotation easier:
goal: If an annotation xy conflicts with a previous one, shift - say up - until there is no conflict with no other…

kabanus
- 24,623
- 6
- 41
- 74
4
votes
2 answers
How to plot annotated heatmap on plotly?
I'm trying to make a annotated heatmap on plotly.
import plotly.plotly as py
import plotly.tools as tls
from plotly.graph_objs import *
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df =…

Yeshwanth Sai Charan
- 43
- 1
- 1
- 5
4
votes
1 answer
Python anotation arrow direction
I am trying to annotate a scatter plot in Python 2.7, with Matplotlib. Here is the plot code:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.DataFrame(np.random.rand(5,3),…

edesz
- 11,756
- 22
- 75
- 123