Skip to main content

All Questions

Tagged with
1 vote
1 answer
60 views

Adding a character within "bquote" in legend

How can I add a word within the bquote in the legend? Using the code x <- 1:100 y <- x^2 plot(x, y) i <- 5 legend("topleft", legend=c(c(as.expression(bquote("X"[.(i)...
user avatar
2 votes
2 answers
3k views

How to put expression in ggplot title/label/legend from character vector?

I want to generate legend labels with code and use them as expressions because they contain greek letters and subscripts. However the same problem occurs with the title, and it is much easier to show, ...
zerz's user avatar
  • 170
1 vote
2 answers
1k views

Formatting line breaks when using superscripts in tmap legend

I am trying to create a map with the tmap showing the population density. Therefore, I want the legend title of the map to be "Population density in n\ [people per km^2]". This map is the ...
Marco Maurer's user avatar
4 votes
2 answers
2k views

Fix legend title when using superscript in more than two lines - R ggplot2

I am plotting a map of my study area and I am having problems to edit the legend title. I need it to be "Projected fruit productivity in fallows in 40 yrs (fruits ha^-1) written in four lines. I could ...
Eduardo Bongiolo's user avatar
0 votes
1 answer
3k views

Change text font in legend using expression function in R

I have the following legend which I am trying to change to the font Times New Roman: legend(x = 23, y = 40, legend = c(expression(bold('Dawn Col-0 Control')), expression(bold('Dusk Col-0 Control')), ...
GW97's user avatar
  • 91
4 votes
3 answers
3k views

How to add degree symbol to multiple plot legend entries in R?

I know I can add a degree symbol to a plot legend by using expression. plot(1:5,1:5) legend('topleft', fill = 'white', legend = expression(5~degree~C)) But How can I do this for multiple legend ...
theforestecologist's user avatar
0 votes
2 answers
391 views

How to remove automatic space after greek lettters using the cairo library?

I am using expression() to create a string that includes greek letters. My legend label is as follows: legend.label = paste(mu, "+", sigma, ", ", mu, ", ", mu, "+", sigma, " of random strategy", sep =...
Sket's user avatar
  • 27
3 votes
1 answer
1k views

Dynamically create expression for ggplot legend?

I want to plot a line graph, with multiple lines, coloured depending on a grouping variable. Now I want to set the legend labels via scale-command: scale_color_manual(values = colors_values, labels = ...
Daniel's user avatar
  • 7,732
4 votes
1 answer
20k views

Greek letters in legend in R

I want to have three curves on the same plot with different parameter alpha. curve(sin(x), from = 1, to = 3, lty = 1, ylim = c(-1, 1)) curve(sin(2 * x), add = TRUE, lty = 2) curve(sin(3 * x), add ...
JACKY88's user avatar
  • 3,483
3 votes
1 answer
497 views

R expression of the form 0 < \alpha < 1

I want to have a legend in an R plot involving expressions. I did legend( x = "topright", legend = c(expression(alpha == 0), expression(0 < alpha)) ) This works just fine. But if I replace ...
mg84's user avatar
  • 287
3 votes
1 answer
1k views

R plot(). Legends with multiple variable per entry

I am somewhat new to R. I have followed and implemented the results in the following two threads: http://tolstoy.newcastle.edu.au/R/e17/help/12/03/7984.html http://lukemiller.org/index.php/2012/10/...
please help's user avatar
4 votes
2 answers
3k views

How to combine character (or numeric) variables with expressions at LEGEND in R

When using R to plot three lines with legend that combines expression and character variables, I wrote, for example: b1<-2 c1<-3 d1<-4 a<-seq(1,10) b<-a+b1 c<-a+c1 d<-a+d1 plot(...
Chenming Zhang's user avatar
0 votes
1 answer
3k views

Add an equation into scatter plots in R

I have a little trouble to add the equations into scatter plots using "legend" A simple example is as follow: plot(1:100) # The below code can work if I add "= 0.1234" directly. legend(locator(1), ...
Jian Zhang's user avatar
  • 1,215
6 votes
2 answers
4k views

Advanced legend in R: Plot

This is a following up question of this question: How to have a new line in a `bquote` expression used with `text`? But now I have it in a legend and this seems to change the things. I tried the ...
Stat Tistician's user avatar
3 votes
2 answers
10k views

R: legend expression how to add comma between two values and how to supress scientific notation

I'm trying to format the legend in my plot, but I have to use expression() because of greek and superscripts. However, when I want to display r^2 = 0.45, P<0.0001, I get r^2 = 0.45 P<1e-04, ...
crazian's user avatar
  • 659

15 30 50 per page