Skip to main content

Questions tagged [scale-color-manual]

The tag has no usage guidance.

scale-color-manual
1 vote
1 answer
38 views

ggplot of multiple geom_sf datasets gives mismatched legend colours

I am trying to create a ggplot map which includes two simple feature line datasets. I would like the lines to either appear in the same legend, or a separate legend. However the approach I am taking ...
David's user avatar
  • 205
0 votes
1 answer
34 views

Using a color scheme and legend labels in plot_model

I would like to plot the results of a multilevel model in R, specifically to illustrate an interaction effect, using plot_model from sjPlot. I would like to use a specific color scheme and I would ...
Becky B's user avatar
0 votes
1 answer
43 views

use two different viridis colour palettes in a single plot [duplicate]

I would like to use two different viridis colour palettes with scale_color_viridis_c to show differences between the two different groups (a and b). Is there a way to change my code below in a way ...
tnt's user avatar
  • 1,418
1 vote
2 answers
59 views

R boxplot ggplot2 4 group but 6 parameter

I am trying to get some customized boxplot using ggplot2 on this data. > dput(Family.boxplot) structure(list(X.Datasets = c(7845L, 7846L, 7847L, 7848L, 7849L, 7866L, 7867L, 7868L, 7869L, 7857L, ...
user3042163's user avatar
1 vote
1 answer
39 views

R coloring and adding lines on a loop

I want to generate a ggplot by adding different lines on a loop. Each line should have its own color. I have attempted this: scenario_colors <- c( "scenario1" = "black", &...
thAngryUnicorn's user avatar
1 vote
1 answer
33 views

Why is ggplot scale_manual not correctly rendered in ggplotly?

I am using ggplot scale_manual to extend legend items to include values absent in the data and it works. However, when I use ggploty to render it, it doesn't work. Is there a work around this? lims &...
BTT's user avatar
  • 13
0 votes
1 answer
65 views

ggplot2 geom_point with both a gradient fill and border color [duplicate]

I'm trying to create an R ggplot2 geom_point plot where the points are gradient filled according to a numeric value, sized according to a numeric value, and border colored according to a boolean value....
dan's user avatar
  • 6,242
1 vote
1 answer
36 views

Shiny in R: apply self-defined function in scale_color_manual() to change the colour of plots based on user-selected variable

I used Shiny application to create scatter plots or box plots based on their selection of variables. I got an error with the usage of ggplot2::scale_color_manual() within the renderPlot() function and ...
01200's user avatar
  • 97
0 votes
2 answers
85 views

R Geom Line, color and shape for the same figures

I used "scale_shape_manual" and "scale_color_manual" to color and shape 5 different variables, they are not on the same column. I want the legend to be just one merged, not ...
Humberto R's user avatar
0 votes
1 answer
42 views

Conflict between scale_color_gradient2() and scale_color_manual()

What I want is to remove diffmean legend produced by geom_segment() and scale_color_gradient2() and add legend for both dotted line and solid line (geom_line()). I have tried: ggplot2::geom_segment(...
piblo95's user avatar
  • 337
0 votes
1 answer
57 views

ggplot2: scale_color and scale_shape of different lengths

I'm trying to re-create this plot in R, but can't seem to get things to match. As I understand it, if I only want 1 legend (shapes and colors in one legend), then scale_shape_manual and ...
Nate's user avatar
  • 553
0 votes
1 answer
441 views

Making a custom scale_color_gradient but assigning number values to the colors

I'm having trouble getting a custom color gradient to work. I want to assign certain colors to certain values but have the colors flow. This is what I've got so far. thi_color_scale<-...
axc's user avatar
  • 3
0 votes
2 answers
193 views

geom_abline doesn't recognize scale_color_manual colors

I have disparate datasets I'm bringing together with ggplot. I can get the colors for lines and legend to work with geom_line, but not geom_abline. For example, this works: df1 <- data.frame(year=c(...
E Maas's user avatar
  • 125
1 vote
1 answer
94 views

Conditional text colour based on background colour (High contrast text) for ggplot (geom_col, and geom_text)

Hello you clever R people! I'm trying to create a stack bar plot showing soil thicknesses with a specific background colour and then add labels to the plot that change colour depending on the ...
James Rowson's user avatar
0 votes
1 answer
77 views

ggplot2 stacked column: How do I sort by date, use custom colors and change the legend?

Separately these seem easy, but I can only complete two of the requirements before breaking the third. What I want to do with a stacked column chart: Group by week and order the stacked bar chart ...
seansteele's user avatar
1 vote
1 answer
154 views

In ggplot(), is there something like `scale_color_manual(), but for line width and line type that can handle 12 lines?

My problem: I need to make many line graphs. Each line graph will contain 12 lines. Each line corresponds to a location. The code will be reused to make 15-20 such plots with standardized formatting. ...
Jeff Boggs's user avatar
0 votes
1 answer
237 views

ggplot: colour of line segments according to variable value, like scale_color_gradient2

I have a df "test_data", which contains values of the recent year ("recent"), the year before ("before") and the difference between these two ("delta"). in the ...
michel's user avatar
  • 33
1 vote
1 answer
60 views

How to color only certain variables in ggplot

I have this data Score<-c(-2, 3, 4, -1, 3, 4, 5, -1, 3, 5, -3, 3, 5, 1, -4, 5, -2, 1, 3, 4, -4, 2, -1, 3, 4, -2, 3, 4, -1, 3, 4, 5, -1, 3, 5, -3, 3, 5, 1, -4, 5, -2, 1, 3, 4, -4,...
JamesLancaster's user avatar
0 votes
0 answers
579 views

Using scale_color_manual in ggplot for a custom legend--colors are not matching the code

I am mapping two independent shapefiles and trying to build a custom legend with the necessary colors. The colors in the legend are not matching what is in the scale_color_manual command. Here is ...
Koda's user avatar
  • 177
0 votes
1 answer
712 views

How to have two scale_color_manuals in ggplot? [duplicate]

I am trying to plot a dataset where the points are colored using the specified colors and text labels are colored using different manually specified colors here is a dummy code to illustrate teh issue:...
yuliaUU's user avatar
  • 1,713
1 vote
1 answer
441 views

How do I add color to individual geom points?

Current Code: ggplot(compare, aes(x=specificity, y=false_positives)) + geom_jitter(height=.02, color=specificity) + scale_discrete_manual(values=c("#999999", "#E69F00", "#...
Antonio's user avatar
  • 407
0 votes
0 answers
100 views

Add custom legend for two variables from the same data set in R

I tried to add custom legend into my R plot that uses same x value but two different y values. I used the approach from the following post but it does not work: Custom legend for multiple layer ggplot ...
nemox007's user avatar
0 votes
1 answer
446 views

Why does ggplot scale_colour_manual na.value parameter not work?

I ran in trouble while using scale_colour_manual's na.value parameter. It simply does nothing. I use the following code to generate a filled contour plot. p1<-ggplot(wc_results_daily, aes(date_day, ...
krisldisl's user avatar
0 votes
1 answer
124 views

How do I combine scale elements by discrete color on ggplot heatmap?

output$fairness_heatmap <- renderPlot({ # Check the user's selection heatmap_data <- NULL groups <- NULL values <- NULL color <- NULL if (input$fairness_metric =...
Matthew Francis's user avatar
3 votes
2 answers
957 views

How to apply different colors for point and text but in the same group?

I am trying to draw a plot in which the colors of the points are red, green, blue for 3 groups and colors of the associated labels are darkred, darkgreen, darkblue. I tried the following code, but the ...
user19402456's user avatar
0 votes
1 answer
3k views

How to use scale_fill_manual to manually define bar plot colors

I am finalizing the representation of my dataset using ggplot2 and for the sake of clarity I would need a coloring scheme that defies standard ggplot2 "logic". Below is a fake dataset to ...
AndreBio's user avatar
0 votes
0 answers
44 views

Big grey area appears in ggplot

I try to plot my data (x-axis - wavelengths. y-axis - variable "FLUO", fluorescence) with gglot on a color scale of the light environment ("light_env_Xday"). My code for plotting ...
Paulina 's user avatar
0 votes
2 answers
217 views

How to fix the legend for a grouped scatter plot added with geom_ablines

I want to make a scatter plot with two different groups (based on Size) each plotted with specified colors (Blue and Red). In addition, I want to add 4 geom_ablines to the scatter plot with the same ...
Muhammad Usama Ashraf's user avatar
0 votes
1 answer
2k views

manually scale color of a factor in ggplot

Let's say i have a data frame like this id password year length Something 1 1234567 2001 7 good 2 pass4 2001 5 bad 3 angel3 2003 6 bad 4 ...
Em Manuel's user avatar
  • 103
2 votes
0 answers
166 views

Duplicate labels using manual scales and Tex command

Let's say that i have the following data. Data<-structure(list(Date = structure(c(14821, 14821, 14822, 14822, 14823, 14823, 14824, 14824, 14825, 14825, 14826, ...
Eve Chanatasig's user avatar
0 votes
1 answer
506 views

ggplot, scale_colour_manual issues

Can anyone spot what is wrong in this code? a <- c("Afghanistan"="darkgreen","Iraq"="red" ,"Mali"="green", "Nigeria"="...
pegasus123's user avatar
0 votes
0 answers
137 views

scale colour problem when max and min are too distant

I am trying to create a dotplot in ggplot, were the scale colour represents the p-value of the data set, but it is not behaving as I expect. The max and min limits of this scale colour are so far in ...
Miriam Riquelme Pérez's user avatar
1 vote
1 answer
2k views

scale_color_manual not working for assigning custermized color [duplicate]

I am working on assigning the same action code with a specific color but the scale_color_manual does not works for me. The color picked up is still by default. Any suggestions? That will be really ...
YihanBao's user avatar
  • 543
1 vote
3 answers
1k views

Setting factor level to be invisible in ggplot2

I think there was an update to ggplot2 that I missed and some things have apparently changed. For a factor level of a variable to be omited or "invisible" you used to be able to set a named ...
Paul Eagle's user avatar
0 votes
1 answer
337 views

ggplot colors correct on legend, wrong on plot?

The legend looks right, but the last two plotted geom_line curves (e.x and ten.x) are grayed-out on the plot. How to fix? 1 Xp <- 1:20/5 X <- -10:10/5 X10 <- -10:5/5 df <- data.frame( ...
Steven Bhardwaj's user avatar
3 votes
1 answer
7k views

ggplot2 scale_color_manual showing all values in legend

I have a report that I create and update which has many different sites for different parameters. Not all parameters are measured at every site. I created a manual color scale so that the sites show ...
Sean Mc's user avatar
  • 33
0 votes
0 answers
108 views

Wrong matching of colours in ggplot using scale color discrete [duplicate]

ggplot() + geom_line(data=Final_UDR_summary, aes(y=pass_rate_IIR, x=year_week, color="blue"),size=1) + geom_line(data=Final_UDR_summary, aes(y=pass_rate_IQR, x=year_week, color=&...
user15981608's user avatar
0 votes
2 answers
2k views

ggplot2 displays wrong colors with manual scale [closed]

I am trying to plot my data with manual color scale based on values. However the colors that are displayed nowhere near correspond to the values that I provide. My data looks like this: # A tibble: ...
kolin's user avatar
  • 53
0 votes
1 answer
1k views

How to fix scale_color_manual? This is not working properly anymore

I am currently struggling with scale_color_manual in ggplot2, although this has never been a problem. I keep getting the error message: "Error: Insufficient values in manual scale. 9 needed but ...
Chiara Homann's user avatar
0 votes
1 answer
542 views

change environment size on scale_colour_manual to assign colour to factors to use across multiples plots

I need to make 5 plots of bacteria species. Each plot has a different number of species present in a range of 30-90. I want each bacteria to always have the same color in all plots, therefore I need ...
Marcela P.'s user avatar
2 votes
1 answer
808 views

How to highlight a single value on a continuous color scale in ggplot2

A question posted here shows how to declare some of the values missing. I have a similar problem except I wish to highlight a single value with a different color eg. mpg = 20. Ideally, I would like it ...
gokhale's user avatar
  • 41
0 votes
1 answer
380 views

Incorrectly displayed names using scale_linetype_manual in r

Let's say that my data is the following structure(list(Date_spill = structure(c(14821, 14821, 14821, 14822, 14822, 14822, 14823, 14823, 14823, 14824, 14824, 14824, 14825, 14825, 14825, 14826, 14826, ...
Eve Chanatasig's user avatar
0 votes
1 answer
109 views

control overlaying lines while color is continuous value in ggplot

I have a data and would like to plot the lines and have control over the order that lines are laying on top of each other. I would like to use 'cale_color_viridis()' as my pallet. I have no idea how ...
say.ff's user avatar
  • 375
1 vote
1 answer
748 views

Share a continuous value-color mapping across several ggplots

I want to make 4 side-by-side scatterplots in ggplot. In each plot, I am coloring the dots by a continuous variable. I would like to have the same values map to the same colors across the four plots ...
acn's user avatar
  • 65
1 vote
1 answer
1k views

ggplot geom_point colour based on multiple factors

I have a dataframe where I am trying to plot the points and separate them based on colour. I can successfully do this if I just set general boundaries like values = c("(-Inf,1]" = "...
L55's user avatar
  • 213
1 vote
1 answer
4k views

Custom colors for discrete values in geom_bar in ggplot R

I am converting a histogram with counts to a proportion chart. I want to make the seven columns on the left green (x values 0-6), the next two are orange (7,8), and the right columns (9 and 10) red. ...
carmadillo's user avatar
1 vote
1 answer
618 views

How to make colors change in a function for monthly plots?

I have spatial-temporal data of migrating species and I want to make a GIF showing their movement throughout the year on a monthly basis. I'm using this code to produce a picture for each month: eb &...
Gotemn's user avatar
  • 29
0 votes
0 answers
97 views

How to exclude legend for a particular plot with multiple plots using scale_color_manual in ggplot2?

I am trying to plot multiple plots using ggplot2 in R. I would like to set manual color pallette and exclude geom_line and geom_point with data_1 in scale_color_manual. Is there a way I can do it? ...
Karthik Iyengar's user avatar
1 vote
1 answer
122 views

Making multi-line plots in R using ggplot2

I would like to compile some data into a ggplot() line plot of different colors. It's rainfall in various places over 100 days, and the data is quite different between locations which is giving me ...
Haley Abrems 's user avatar
1 vote
2 answers
1k views

Show entire legend even when a category is not displayed in the graph

I am working on a graph to show the hitting patterns of baseball players. The location on a grid corresponds to where the ball was hit, and the colour of the circle corresponds to the outcome (single, ...
nickfarnell's user avatar

15 30 50 per page