Skip to main content

All Questions

Tagged with
1 vote
0 answers
35 views

How to align legend elements in the middle when they are on two rows using ggplot2?

In the MWE below, the caption appears separated into two rows. I want the item corresponding to gear 5 to be aligned in the middle in relation to gears 3 and 4 above it. How can I do this? library(...
Daniel Valencia C.'s user avatar
0 votes
1 answer
94 views

How do I add a legend to ggplot with two scatter plots (geom_point() )

I have a table I read into R to plot with ggplots. I need to plot two sets of data points and also use an ifelse condition to be able to show specific genes. I would like to show a legend to the plot, ...
Assa Yeroslaviz's user avatar
1 vote
1 answer
105 views

How to customize the legend order for a 3D scatter plot?

I'm trying to generate a 3D scatter plot and the shapes of markers correspond to 'Treatment' (IC, IT, YS), whilst, the colors correspond to 'Time' (0, 2, 4, 6, 12, 24, 48, 72). Everything went well ...
SIV0625TriX's user avatar
1 vote
1 answer
75 views

Title and legend adjustment with `grid.arrange`

I have 6 different plots in R that I want to arrange in one plot with grid.arrange. They share the same legend, but whenever I want to put a common legend, the sizes of the plots are adjusted ...
Masal Gezici's user avatar
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
34 views

Legend of the library Fantaxtic

I am running the library fantaxtic in R studio. I want to make a bar chart or something like that. However, in the legend I don't want any title in the legend and the category Other is located at the ...
user1892205's user avatar
0 votes
1 answer
35 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
47 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
56 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
30 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
72 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

15 30 50 per page