Questions tagged [direct-labels]

An R package for attaching labels to points, lines and contours in ggplot and lattice plots

directlabels is an R package for attaching labels to points, lines and contours in ggplot2 and lattice plots. The motivation for using directlabels is that the labels, in most instances, are easier to read and interpret than legends; and thus the labels can be used in place of legends.

Examples, vignettes, and links to additional resources are available on the package's old R-forge site and in the directlabels documentation link. Also see the package's github site.

Related tags

48 questions
3
votes
1 answer

Adding labels onto calculated stat_smooth lines ggplot geom_dl

I've been trying to directly add labels to my linear model scatter plot, with some difficulty. I've read these articles (How to show directlabels after geom_smooth and not after geom_line?) and I think that I need to use the geom_dlfunction in…
pr1g114413085
  • 155
  • 1
  • 11
3
votes
1 answer

How to plot labels to corresponding line (on this plot) in ggplot2?

I have this data: F.acc date Specie 15% 30% 45% 60% 75% -15% -30% -45% -60% 1 1990 Acciughe 0.0750600 0.0750600 0.0750600 0.0750600 0.0750600 0.0750600 0.0750600 0.0750600 0.0750600 2 1991…
skylobo
  • 151
  • 1
  • 9
3
votes
1 answer

Labeling two contours with direct.labels

I'm trying to compare two scalar fields and want to draw them in the same plot using contours labeling their values with directlabels. The thing is, I'm not able to use two direct labels in the same plot.…
Elio Campitelli
  • 1,408
  • 1
  • 10
  • 20
3
votes
1 answer

Using directlabels::geom_dl when label is the same for two groups

I have a problem with geom_dl() where it is not placing my label correctly because two groups have the same label. I can see that data$groups <- data$label inside of the GeomDl call is causing the trouble, but I can't figure out how to fix it. This…
fishgal64
  • 94
  • 7
3
votes
1 answer

create vertically non-overlapping labels next to boxplot using ggplot2

If want to create a boxplot with overlaid points which are labeled at the right hand side. I tried geom_dl form the directlabels package, but get stuck. library(ggplot2) library(directlabels) set.seed(0) x <- data.frame(label=LETTERS[1:15], …
Mark Heckmann
  • 10,943
  • 4
  • 56
  • 88
3
votes
1 answer

R Bubble chart: labels overlapping

Attempting to code a function that returns a bubble chart from aggregated data. I'm passing it a column of a data.frame in "agg". aggs2 <- function(agg, deporur=0, all=TRUE){ ##create aggregate from library data agg1 <- aggregate(agg,…
David Gerrard
  • 161
  • 1
  • 9
3
votes
2 answers

Moving directlabels slightly to left

I am trying to move my direct labels just slightly to the left, not one group but all groups. By default dl.move only moves one group at a time. library(directlabels) library(ggplot2) count <- c(1,5,6,7,8,8) year <-…
Dan KS
  • 123
  • 2
  • 13
3
votes
1 answer

How can I change the text size of directlabels on a ggplot graph?

I am attempting to use directlabels to apply labels to a lasso plot as shown here. I am able to put the labels on the page, but am unable to change the size. Passing additional arguments in a list allows me to change other elements, but not text…
Erik Shilts
  • 4,389
  • 2
  • 26
  • 51
2
votes
0 answers

Using geom_dl to label multiple geom_smooth plots

I have a dataset of all football (soccer) transfers made in the last fifteen seasons. I am doing a regression analysis with the placement of the teams. I am plotting the lines via geom_smooth for all of the five respective leagues. I have chosen to…
Antlserum
  • 21
  • 1
2
votes
1 answer

Direct labels puts labels at wrong place

I'm trying to do a plot with ggplot2 and trying to put labels at the right place on mean trajectories with confidence regions. Since I cannot share my data, I created a reproducible…
coolsv
  • 781
  • 5
  • 16
2
votes
1 answer

How to change font size and colour directlabels in ggplot

I have some trouble changing the format of my line labels (colour and size). Can somebody point me in the right direction? colnames(dfm) = c("date", "portfolio", "return") p1<- ggplot(dfm) + geom_line(aes(x = date, y = return, color = portfolio))…
incognito
  • 25
  • 4
2
votes
2 answers

Selecting factor for labels (ggplot2, directlabels)

I'd like to use the package directlabels to label my plot. However, I'd like the label to be the ID of each point. Is there really no way to select which factor to label or did I miss that? library(ggplot2) library(directlabels) df <- structure( …
erc
  • 10,113
  • 11
  • 57
  • 88
2
votes
0 answers

How to use expressions with directlabels in ggplot

I was looking for a way to avoid overlapping of labbels in scatterplots. I found directlabels which is working fine but does not allow me to use expressions as labels nor to select which labels I want to be displayed and which I don't. Here is an…
1
vote
1 answer

geom_text labels swap places when values are the same

I'm trying to use geom_text as the legend for my line graph, but I also need to have COUNT as labels (work requirement). When I run the code below, I can get both labels, the values and the category names and format them differently so the legend is…
1
vote
1 answer

add percentage to barplot with position = fill

I have createg stacked barplot with the corresponding lables inside of the bars are. However, I would like to change the plot, such that position = fill. This does something weird with my plot. Any ideas how to fix this ? cat <- c…
Nneka
  • 1,764
  • 2
  • 15
  • 39