Skip to main content
remove tags from title
Source Link
Konrad Rudolph
  • 4.9k
  • 16
  • 45

Changing the legend names: R-ggplot2

ggplot(dataset, aes( x = Norm, fill = Condition, y=log2(measure))) + geom_boxplot() +
        scale_fill_manual(values=c("brown1","darkolivegreen4","burlywood3")) + theme_classic() + 
        labs(title="Comparison",x="Norm", y = "counts") +
        scale_fill_continuous(labels = paste("condition1", "condition2", "condition3"))

I am trying to change the labels of the legend. Currently, it shows the labels that are present in my dataset. However, I want to change it to "condition1", "condition2", "condition3". Above is the code I am trying. It gives me following error.

Scale for 'fill' is already present. Adding another scale for 'fill', which will replace the existing scale. Error: Discrete value supplied to continuous scale In addition: Warning message: Removed 18 rows containing non-finite values (stat_boxplot).

Could someone help me here? TIA

Changing the legend names: R-ggplot2

ggplot(dataset, aes( x = Norm, fill = Condition, y=log2(measure))) + geom_boxplot() +
        scale_fill_manual(values=c("brown1","darkolivegreen4","burlywood3")) + theme_classic() + 
        labs(title="Comparison",x="Norm", y = "counts") +
        scale_fill_continuous(labels = paste("condition1", "condition2", "condition3"))

I am trying to change the labels of the legend. Currently, it shows the labels that are present in my dataset. However, I want to change it to "condition1", "condition2", "condition3". Above is the code I am trying. It gives me following error.

Scale for 'fill' is already present. Adding another scale for 'fill', which will replace the existing scale. Error: Discrete value supplied to continuous scale In addition: Warning message: Removed 18 rows containing non-finite values (stat_boxplot).

Could someone help me here? TIA

Changing the legend names

ggplot(dataset, aes( x = Norm, fill = Condition, y=log2(measure))) + geom_boxplot() +
        scale_fill_manual(values=c("brown1","darkolivegreen4","burlywood3")) + theme_classic() + 
        labs(title="Comparison",x="Norm", y = "counts") +
        scale_fill_continuous(labels = paste("condition1", "condition2", "condition3"))

I am trying to change the labels of the legend. Currently, it shows the labels that are present in my dataset. However, I want to change it to "condition1", "condition2", "condition3". Above is the code I am trying. It gives me following error.

Scale for 'fill' is already present. Adding another scale for 'fill', which will replace the existing scale. Error: Discrete value supplied to continuous scale In addition: Warning message: Removed 18 rows containing non-finite values (stat_boxplot).

Could someone help me here?

added 4 characters in body
Source Link
Devon Ryan
  • 19.8k
  • 2
  • 30
  • 60

ggplot(dataset, aes( x = Norm, fill = Condition, y=log2(measure))) + geom_boxplot() + scale_fill_manual(values=c("brown1","darkolivegreen4","burlywood3")) + theme_classic() + labs(title="Comparison",x="Norm", y = "counts") + scale_fill_continuous(labels = paste("condition1", "condition2", "condition3"))

ggplot(dataset, aes( x = Norm, fill = Condition, y=log2(measure))) + geom_boxplot() +
        scale_fill_manual(values=c("brown1","darkolivegreen4","burlywood3")) + theme_classic() + 
        labs(title="Comparison",x="Norm", y = "counts") +
        scale_fill_continuous(labels = paste("condition1", "condition2", "condition3"))

I am trying to change the labels of the legend. Currently, it shows the labels that are present in my dataset. However, I want to change it to "condition1", "condition2", "condition3". Above is the code I am trying. It gives me following error.

Scale for 'fill' is already present. Adding another scale for 'fill', which will replace the existing scale. Error: Discrete value supplied to continuous scale In addition: Warning message: Removed 18 rows containing non-finite values (stat_boxplot).

Could someone help me here? TIA

ggplot(dataset, aes( x = Norm, fill = Condition, y=log2(measure))) + geom_boxplot() + scale_fill_manual(values=c("brown1","darkolivegreen4","burlywood3")) + theme_classic() + labs(title="Comparison",x="Norm", y = "counts") + scale_fill_continuous(labels = paste("condition1", "condition2", "condition3"))

I am trying to change the labels of the legend. Currently, it shows the labels that are present in my dataset. However, I want to change it to "condition1", "condition2", "condition3". Above is the code I am trying. It gives me following error.

Scale for 'fill' is already present. Adding another scale for 'fill', which will replace the existing scale. Error: Discrete value supplied to continuous scale In addition: Warning message: Removed 18 rows containing non-finite values (stat_boxplot).

Could someone help me here? TIA

ggplot(dataset, aes( x = Norm, fill = Condition, y=log2(measure))) + geom_boxplot() +
        scale_fill_manual(values=c("brown1","darkolivegreen4","burlywood3")) + theme_classic() + 
        labs(title="Comparison",x="Norm", y = "counts") +
        scale_fill_continuous(labels = paste("condition1", "condition2", "condition3"))

I am trying to change the labels of the legend. Currently, it shows the labels that are present in my dataset. However, I want to change it to "condition1", "condition2", "condition3". Above is the code I am trying. It gives me following error.

Scale for 'fill' is already present. Adding another scale for 'fill', which will replace the existing scale. Error: Discrete value supplied to continuous scale In addition: Warning message: Removed 18 rows containing non-finite values (stat_boxplot).

Could someone help me here? TIA

Source Link

Changing the legend names: R-ggplot2

ggplot(dataset, aes( x = Norm, fill = Condition, y=log2(measure))) + geom_boxplot() + scale_fill_manual(values=c("brown1","darkolivegreen4","burlywood3")) + theme_classic() + labs(title="Comparison",x="Norm", y = "counts") + scale_fill_continuous(labels = paste("condition1", "condition2", "condition3"))

I am trying to change the labels of the legend. Currently, it shows the labels that are present in my dataset. However, I want to change it to "condition1", "condition2", "condition3". Above is the code I am trying. It gives me following error.

Scale for 'fill' is already present. Adding another scale for 'fill', which will replace the existing scale. Error: Discrete value supplied to continuous scale In addition: Warning message: Removed 18 rows containing non-finite values (stat_boxplot).

Could someone help me here? TIA