Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
0 answers
26 views

Entrywidth argument not working in R plotly

I am trying to make an interactive plot with the plotly package. The legend needs to be next to the image and have a certain width. I now have the issue that the default appears to be that the legend ...
Bramminator's user avatar
0 votes
1 answer
54 views

How do you remove pattern_fill legend?

I'm wondering how and if it's possible to remove the legend created by pattern_fill? This is my data: #To use non-english characters Sys.setlocale("LC_ALL", "nb-NO.UTF-8") library(...
Henning Åsheim's user avatar
0 votes
1 answer
36 views

One variable with three colors, but only one color on the legend

I have two variables in my table. I want one of them to appear with three colors on the graph, but only one color on the legend. How can I remove the NAs, which don't correspond to separate variables, ...
Montacer's user avatar
0 votes
1 answer
48 views

Removing underscores from ggplot2 boxplot [duplicate]

I would like to remove an underscore out of my ggplot2 boxplot (the head of fill "fungicide_treatment". I already tried to change the column head in my excel data file, and I tried already ...
Stephan Graßl's user avatar
0 votes
1 answer
39 views

Ggplot2 fill legend labels not in correct order

I am creating the following graph with ggplot2. The problem is that all labels show in the chronological order except the last three. I cannot work around it. Does anyone see what causes the issue and ...
Joe94's user avatar
  • 125
1 vote
1 answer
41 views

how to change the legend sharp to circle

library(ggplot2) food_choices <- c("Pizza", "Pasta", "Sushi", "Caesar Salad") counts <- c(17, 10, 8, 11) table <- data.frame(food_choices, counts) # ...
walter's user avatar
  • 11
0 votes
1 answer
20 views

How to turn off lines in raster fill label mixed legends ggplot

I'm plotting points and two sets of spatial lines (roads and rivers) on top of a categorical raster. I can define the colors and labels of the rasters and give that legend a title and it looks great. ...
Jade131621's user avatar
0 votes
1 answer
61 views

Force keys size to be smaller in multiple lines legend in ggplot

Is there any way to force legend key sizes to be independent from line height when we have legend text with multiple lines? I tried legend.key.height, ggtext::element_textbox_simple, and guides but ...
rez's user avatar
  • 338
0 votes
1 answer
78 views

Sharing multiple legend symbols within a ggplot2 scatterplot

I am trying to create a simple scatterplot in ggplot2 that has a unique shape for each factor level but certain colours are the same. I can achieve this, but would like a nicer looking legend where I ...
James White's user avatar
0 votes
1 answer
31 views

Adding a manual legend without extending the plot

I have been trying to add a manual legend to my graph using the following code. However when I add this code it extends the x-axis and I don't understand why. df %>% group_by(Site) %>% ...
Erin's user avatar
  • 3
0 votes
1 answer
73 views

How can I center my legend labels in ggplot?

I created a legend with a range of rates for a map. Currently, my labels appear adjacent to the breaks, I want the labels to appear adjacent to the center of each level. Here's my code... ggplot(...
alocklear's user avatar
1 vote
1 answer
31 views

Order ggplot legend differently than elements in plot

Is there a way to order a legend in ggplot differently than the elements on the plot. for example I want the legend to be ordered Calanoida, Cladocera, Rotifera, and Cyclopoida but I want the ggplot ...
confusedindividual's user avatar
1 vote
2 answers
60 views

Unwanted characters in GGPlot 2 legend entries for stacked area chart

Good day, I need to prepare a graph showing the proportions of the various biomass components, but it is showing ,1 after each component in the legend in R, Ggplot2. I only want to see the list of ...
Otto_P's user avatar
  • 11
0 votes
2 answers
37 views

ggplot2 legend not appearing

I'm having trouble producing a legend for my ggplot2 figure of categorical point data with a bar indicating the mean overlaid on top. plot <- ggplot(df, aes(tree, o18)) plot + geom_point() + ...
Lmack101010's user avatar
1 vote
1 answer
27 views

Avoid vlines groups to appear in legend

I want to make a line plot with custom colors and additional vlines with custom colors too. It all works well except I cannot find a way of removing the vline groups from the legend... after checking ...
DaniCee's user avatar
  • 2,859

15 30 50 per page