Use this tag for questions related to annotating plots, e.g. adding descriptive labels or annotations to data points.
Questions tagged [annotate]
490 questions
425
votes
9 answers
Scatter plot with different text at each data point
I am trying to make a scatter plot and annotate data points with different numbers from a list.
So, for example, I want to plot y vs x and annotate with corresponding numbers from n.
y = [2.56422, 3.77284, 3.52623, 3.51468, 3.02199]
z = [0.15, 0.3,…

Labibah
- 5,371
- 6
- 25
- 23
119
votes
1 answer
How to left align text in annotate from ggplot2
My example is:
qplot(mtcars$mpg) +
annotate(geom = "text", x = 30, y = 3, label = "Some text\nSome more text")
How do I get the text here to be left aligned? So that the 'Some's line up with each other.

kennyB
- 1,963
- 3
- 17
- 22
97
votes
3 answers
Label python data points on plot
If you want to label your plot points using python matplotlib, I used the following code.
from matplotlib import pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
A = anyarray
B = anyotherarray
plt.plot(A,B)
for i,j in zip(A,B):
…

ashley
- 1,535
- 1
- 14
- 19
91
votes
5 answers
How to fix overlapping annotations / text
I'm trying to stop annotation text overlapping in my graphs. The method suggested in the accepted answer to Matplotlib overlapping annotations looks extremely promising, however is for bar graphs. I'm having trouble converting the "axis" methods…

homebrand
- 1,143
- 1
- 9
- 9
28
votes
2 answers
Changing background color for a text annotation to increase contrast and visibility
I'd like to change the background color for my annotate text so that it's green and covers up anything behind it (like the horizontal line in the example below). How do I do that?
ggplot() +
geom_hline(yintercept=0) +
…

Andy Stein
- 461
- 1
- 4
- 11
24
votes
1 answer
R: How can I annotate a ggplot with a text box?
I am looking to add a small white text box, with custom text in the body of my ggplot plot. The text I want to add is to identify a horizontal line I am adding to the plot.
ggplot(cb_emp) +
geom_point(aes(x = grossunits,
y =…

ChetanMV
- 255
- 1
- 2
- 5
23
votes
3 answers
Eclipse Equivalent of IntelliJ's Annotate (or Git Blame)
It's been a minute since I've developed in Eclipse. Is there an equivalent of IntelliJ's annotate feature?
In essence, you right click on the margin and select annotate. After which in the margin you see who the last people were who made…

James Oravec
- 19,579
- 27
- 94
- 160
21
votes
2 answers
Very confused... problem using 'annotate' in Django
So I have two models, a Ranking model and a UserRanking model. The app centers on people taking a list of items and ranking them (ex: "Best Movies of 2008"). The Ranking model is the overall aggregate ranked list, which is calculated from all the…

Daniel Waltrip
- 2,530
- 4
- 25
- 30
20
votes
4 answers
django aggregate or annotate
This is a very stupid thing, I know, but I just don't seem to get the handle on Django aggregate and annotate functions.
I have a very simple set of models: Events, Areas and Types. An event has foreign keys pointing to Area and Type. I would…

freethrow
- 1,068
- 3
- 20
- 34
20
votes
2 answers
multiple annotate Sum terms yields inflated answer
In the following setup, I'd like a QuerySet with a list of projects, each annotated with the sum of all its task durations (as tasks_duration) and the sum of all of its tasks' subtask durations (as subtasks_duration). My models (simplified) look…

Charl Botha
- 4,373
- 34
- 53
20
votes
4 answers
Matplotlib: Add strings as custom x-ticks but also keep existing (numeric) tick labels? Alternatives to matplotlib.pyplot.annotate?
I am trying to produce a graph and I am having some issues annotating it.
My graph has a log scale on the x-axis, showing time. What I want to be able to do is keep the existing (but not predictable) numeric tick labels at 100 units, 1000 units,…

FakeDIY
- 1,425
- 2
- 14
- 23
19
votes
1 answer
django annotate unexpected limit 21
I want use django ORM to finish count group by, but select sql unexpected limit 21 every time. I don't want the limit, why limit 21 appear, and how can I get all data?
model:
class Company(models.Model):
company_no =…

ivy
- 191
- 1
- 4
19
votes
3 answers
Annotate a queryset with the average date difference? (django)
I searched all over place for an answer to this but couldn't find anything. Perhaps this is just a stupid question or a really tricky one. Here it is:
Let's say my model is this (pseudo django code):
Event
type = ForeignKey(EventType)
name =…

Nicolas R
- 991
- 2
- 8
- 17
19
votes
2 answers
git blame: correct author after merge
A GIT merge introduces a new commit. This causes problems with "git blame": the merged lines appear to be committed by the developer that did the merge.
I can understand this being the case for conflicting changes (because he solved the conflicts).…

Cristian Vasile Mocanu
- 493
- 5
- 13
19
votes
4 answers
In django, is there a way to directly annotate a query with a related object in single query?
Consider this query:
query = Novel.objects.< ...some filtering... >.annotate(
latest_chapter_id=Max("volume__chapter__id")
)
Actually what I need is to annotate each Novel with its latest Chapter object, so after this query, I have to execute…

SAPikachu
- 579
- 1
- 3
- 17