Skip to main content

All Questions

Tagged with
561 questions with no upvoted or accepted answers
5 votes
0 answers
4k views

How to remove legend in the default r plot() function

I have a simple R plot (i.e. plot(object)) and would like to suppress the legend. I am not, and cannot, use ggplot - how do I prevent R adding a legend to the plot?
user265883's user avatar
5 votes
0 answers
488 views

Why legend box size increases when I zoom plot in r?

When I use legend command in r, the size of the legend box is true, but when I zoom plot, the size of the legend box increases with a large scale. Are there any options to set height and width of ...
mohammad's user avatar
  • 175
5 votes
0 answers
348 views

Legend is displaying additional shape

I'm using the following data frame: df1 <- structure(list(Genotype = structure(c(1L, 1L, 1L, 1L, 1L, 2L,2L,2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L,1L, 2L, 2L, 2L, 2L, 2L,...
John Gagnon's user avatar
4 votes
0 answers
831 views

How to change legend text formatting in Leaflet in R?

I've created a leaflet map and I'm trying to figure out how I can change the formatting of the legend labels. I currently have a gradient color palette to represent the data, with a set of discrete ...
nkt95's user avatar
  • 65
4 votes
0 answers
418 views

R leaflet map - combine layer group selection with the legend?

I know there are several R leaflet threads on here about showing the legend of layers only when those layers are selected using the addLayersControl command. But my questions is slightly different a ...
tfarrugia's user avatar
4 votes
1 answer
327 views

How can I make a cyclic, donut-like color legend in ggplot?

CONTEXT I have some data that looks like this: val = 0:100 sample_data = data.frame( t=val, px=cos(2*pi*val/100), py=sin(2*pi*val/100), v_angle = (val*360/100 + 90) %% 360 ) I am ...
Max Candocia's user avatar
  • 4,407
4 votes
1 answer
1k views

R ggplot 2 legend border issue

I know this is minor, but it's for a publication and will drive me crazy. The bottom of the P0688 box is like 1-2 pixels thinner than the rest. I don't want to make the borders thicker because then it ...
Paul Manley's user avatar
4 votes
0 answers
450 views

in R, creating multi column legend in ggplotly

How do you spread a legend over multiple columns in ggplotly? The answer here makes it obvious how to do so using ggplot() - however that code doesn't seem to work when I use ggplotly() library(...
val's user avatar
  • 1,689
4 votes
0 answers
7k views

r-legend in stacked bar plot

I'm relatively new to R and struggling to get my legend in the correct place. I've had a good look online and just can't seem to figure it out. # rating no yes # 1 140 38 # 2 72 46 # ...
N Gross's user avatar
  • 41
4 votes
0 answers
2k views

Plot legend problems using R. Help removing excessive white space in legend box

I am creating a plot of some hydrology data and I am having trouble with the legend. The legend has a large amount of blank space around the text. I have tried using par(mar= list), cex, x.intersp, ...
blinid's user avatar
  • 41
3 votes
0 answers
62 views

Plot a boolean/qualitative table with R

I am looking for a way to create a table in R for categorical data. The elements in the table should be symbols, and these symbols should be displayed in a legend. This table from the ICILS 2018 ...
saykodelikat's user avatar
3 votes
1 answer
689 views

R ggplot2 overlapping histogram, adding in legend for overlapping part

I have a histogram that is plotting 2 different groups with some overlap between them. I have been able to manually color the groups and a legend is generated for each group, however I am asking how ...
Cyph's user avatar
  • 81
3 votes
0 answers
331 views

How to get R Plotly pie charts to show legends based on values other than labels

I am plotting a pie chart with R plotly which I want to slice the pie based on column A and color each slice based on column B. I want each slice to show label based on column A, and I want the ...
Bernard's user avatar
  • 73
3 votes
0 answers
464 views

Change title legend position using guides() without breaking the legend into discrete numbers

I was wondering if you can help me out with a (probably silly) problem with my code that is driving me nuts. I'm using R and my problems are with the package sf + ggplot2. Is there anyone out there ...
bmora's user avatar
  • 77
3 votes
0 answers
2k views

Theme(position.legend="none") doesn't work with coord_flip()

I want to have a horizontal bar chart, but without legend. When I run the script below without coord_flip(), no legend shows. But when I run it with the coord_flip() argument, the legend appaers. I ...
SHW's user avatar
  • 491

15 30 50 per page
1
2 3 4 5
38