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

All Questions

Tagged with
0 votes
0 answers
34 views

Same scale in legend for circular bar plot

Building on this post and code (with reproducible example) Different fill color for negative values in circular barplot, I want to plot two of these figures together as a comparison, like this: But ...
MoonS's user avatar
  • 175
1 vote
1 answer
35 views

remove one legend entry in legend of dendrogram

I am experiencing issues with the legend entries of a dendrogram. I am utilizing the code example provided here. library(ggplot2) library(ggdendro) library(plyr) library(zoo) df <- USArrests ...
Excelsior's user avatar
  • 181
0 votes
0 answers
218 views

Legend with ggplot and geom_sf

I have built a map of Toulouse using ggplot and geom_sf for having only the elements I want, eg. main roads, river, railways, ... Then I need to plot the n bike stations, each one colored with the n ...
Bertrand Jouve's user avatar
3 votes
1 answer
72 views

Sharing multiple ggplot legend symbols with one label

I am trying to create a stacked barplot for one response over time (Year) across 3 different sites that I've separated into different facets (facet_wrap). I would like different colours per facet, and ...
James White's user avatar
0 votes
0 answers
83 views

How I make the arrows to be same, but represent a trend in R ggplot?

I need my map to look like this: But now it only shows shows the colour of an arrow and the legend is comletely wrong Dataframe: instorks_trends <- data.frame( Country = c("Portugal", &...
user22887359's user avatar
1 vote
1 answer
32 views

Changing Legend in ggplot2 in R

Here is an example dataframe: Tag/Percentage/type A 0,3 1 E 0,4 1 F 0,5 2 F 0,6 2 G 0,5 3 T 0,2 3 H 0,1 4 I'm trying to plot the ...
Miga's user avatar
  • 31
2 votes
2 answers
55 views

Legend showing wrong color in ggplot geom_sf

I am making a map where I need some cities to be points of a certain color (A cities) and some cities to be points of a different color (B cities). All B cities are also on the A list so I put the B ...
Alyssa's user avatar
  • 23
0 votes
3 answers
44 views

Separated legend between two variables in ggplot

I have a dataframe which look like this : From it, I want to make a plot which look like this : I used ggplot and LibreOffice Draw to make the above plot. I wish to use ggplot only. Here is a ...
armandfavrot's user avatar
0 votes
0 answers
20 views

Creating custom legends in ggplot? [duplicate]

I have a data set that I add multiple layers to the original data and colors for this information. I want to highlight specific plots on the graph and add those to a legend. From what I have found I ...
wchristensen1024's user avatar
0 votes
1 answer
41 views

Changing Title of Legend in ggplot2 Creates a Second Legend?

I am pretty new to R/working with data and am trying to change the title of the legend in a visualization I made. I have tried using fill= in the labels() function I have but it adds another legend ...
aoao's user avatar
  • 3
1 vote
2 answers
320 views

Customize legend with discrete labels for heatmap with continuous but binned data

I have created a heatmap in ggplot with continuous temperature data and scale_fill_viridis_c: To make it easier to read I am testing a binned version with scale_fill_viridis_b and n.breaks: My ...
Martin Liungman's user avatar
0 votes
1 answer
35 views

scale_fill_identity plot legend with full values, not only values present in data

My data: structure(list(day = c("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "...
piblo95's user avatar
  • 337
1 vote
1 answer
86 views

ggplot: How to drop certain factor level from legend while still be able to set its colour?

I need do make density plots of the age of the workers of a company. One density plot shall show age of all workers and the other split by sex. It is something like this: # Load libraries. library(...
LulY's user avatar
  • 1,070
1 vote
1 answer
38 views

annotate box to follow legend position ggplot2

My data: plot_data <- structure(list(date = structure(c(18993, 18994, 18995, 18996, 18997, 18998, 18999, 19000, 19001, 19002, 19003, 19004, 19005, 19006, 19007, 19008, 19009, 19010, 19011, 19012, ...
piblo95's user avatar
  • 337
0 votes
2 answers
46 views

in ggplot2 , how to make different legend on the different position

Blow plot have two legend size and color ,currently the positon on right .How to marke size legend on the left ,meanwhile the color legend on the top ? Thanks! library(tidyverse) diamonds %>% head(...
anderwyang's user avatar
  • 2,283

15 30 50 per page
1
3 4
5
6 7
118