'ggplot2 custom colour based on factor
Hello stackoverflow community,
I would love to get some ideas to improve my existing plot.
So I have a correlation dataframe in long format which roughly looks as follows:
and my idea was to make a factor of A since I have fewer As and they correlate with many Bs and plot the correlation value for each A with B using the following code. however, in the B column some labels exactly match with A
I was wondering if anyone of you could give me ideas on how could this be possible, to just colour the elements in B which exactly match with elements in A.
Best,
ggplot(df, aes(x=B, y=correlation_value)) + geom_point() + theme(axis.text.x = element_text(angle = 90, hjust = 1),text=element_text(size=8))+ facet_wrap( ~ factor(df$A))
The code runs fine but I want to improve it further by adding custom colour. However, this colour should only be for points in B whose names match with A
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

