Home>
I have made a graph where the points are marked with different colors (depending on the parameter a), on the graph I need to save the names of the samples (points). At the same time, in the notation of the chart legend, I need squares indicating the color. But instead, in the notation of the legend, I get the "a" icon of the right colors, which looks rather ridiculous.
How can I change the "a" in the legend to squares/circles so that the names of points of different colors are preserved on the chart?
Code for the graph:
ggplot(data=mds.data, aes(x=X, y=Y,label=Sample, color=a)) +
geom_text() +
theme_bw() +
xlab(paste("PCoA1 -", mds.var.per[1], "%", sep="")) +
ylab(paste("PCoA2 -", mds.var.per[2], "%", sep="")) +
ggtitle("PCoA plot using dtw-distance")+
scale_color_manual(name="a=",labels=c("0.25", "0.5","0.75","1"),values = c("red3","forestgreen","darkblue","orange") )
I accidentally created two accounts, how do I merge them?
aleksandr barakin2022-02-14 10:10:32@black_paladin changed the code to a simpler one to show what the problem is.
Диана2022-02-14 12:43:48Related questions
- Signatures for columns in geom_histogram
- Visualization of the multiple regression model
- R. Add correct legend to ggplot plot
- r - about handling geom_vline in ggplot2
- i don't know how to format data for graph drawing with r and ggplot
- coastline plot in r
- r - i want to use a function instead of opts in ggplot2
- i want to specify the bubble color using variables in the data frame with ggplot2 of r
- cannot create line graph with ggplot2
Vector content eh? Please provide reproducible code with data.
black_paladin2022-02-15 04:45:14