**500**wrote:

Im using two condition wild type and treated I get a scatter but i want to have two different colors Im not sure how to do it , I tried to group them by melting i got aesthetics error so i removed the gene column only i have two column but the data points are labelled as same

```
df <- HL_60
#gene = df[,1]
WT = df[,2:3]
ATRA = df[,4:5]
wt.mean = apply(WT,1,mean)
atra.mean = apply(ATRA,1,mean)
WT_ATRA = cbind.data.frame(wt.mean,atra.mean)
head(WT_ATRA)
library(ggplot2)
library(ggpmisc)
D1 <-WT_ATRA
head(D1)
my.formula <- y ~ x
p <- ggplot(data = WT_ATRA, aes(x= wt.mean,y = atra.mean) )+ geom_point(color = 'red',size = .9)+
geom_smooth(method = "lm", se=FALSE, color="black", formula = my.formula) +
stat_poly_eq(formula = my.formula,
eq.with.lhs = "italic(hat(y))~`=`~",
aes(label = paste(..eq.label.., ..rr.label.., sep = "*plain(\",\")~")),
parse = TRUE)
```

The figure i get is this

Any suggestion or help how to put two colour for two different condition would be highly appreciated

**1.4k**• written 16 months ago by krushnach80 •

**500**

Please don't follow this as it is not possible with this plot, see the discussion below. Apologies for recommending this before looking at the data.

4.2kwell I would be glad if you could show me in my code , which i posted because I did earlier when i melt i get I get one coloumn for gene ,one column variable and the last one value..but I still couldn;t figure it out

500am I not doing the same thing when Im binding the column one is for my wild type and the other one is treated...

500Can you post some example data that resembles HL_60?

4.2kMy first column is my gene rest are my sample first one is my control wild type rest are treated so im making pairwise comparison

500So, what should colour represent? I honestly don't get it.

770well to me what i need is the R^2 value but to my boss he needs that the sample labelled to show that it shows that the data points are coming from two different condition I would be glad it you can solve my woe

500Hi krushnach80. I believe that your supervisor does not understand the plot.

What you are plotting cannot be colour-coded based on 2 different conditions because the values in your plot are summarising a difference between both conditions. This just a simple scatter plot comparing the mean in disease versus WT.

You could colour the dots in a gradient fashion based on the intensity of the mean.

43kyeah I m just plotting the replicates just to show that when there is induction with ATRA and VD3 the R^2 decreases to prove that yes after induction there is a change in the expression ,but do you have any other way to show the difference using scatter plot

500what i understad is he want those coming from WILD type should have one colour and the one coming from ATRA treatment a different color because thats how he got scatter plot when he did it using seqmonk tool ,I m trying to do the same

500...but, if you wanted to do that, then each dot would have 2 colours because each dot represents both WT (value on x-axis) and ATRA (value on y-axis).

You probably mean something like this: https://www.bioinformatics.babraham.ac.uk/projects/seqmonk/Help/3%20Visualisation/3.2%20Figures%20and%20Graphs/scatter_plot_sublists.png

In that plot, only certain dots are shaded, presumably those that have passed some other statistical test like FDR-corrected P values or fold-change, somewhat akin to a volcano plot.

43kyeah exactly like that seqmonk plot and for this yes " then each dot would have 2 colours because each dot represents both WT (value on x-axis) and ATRA (value on y-axis)." because a I have same number of gene for both the condition WT and ATRA...I played around all kind of combination to put two different colour for WT and ATRA for same gene as they have different values

And I have given my small data sets

500To give you an example, this code will colour red (firebrick1) any genes that have linear fold change >= 4.0 in ATRA, and colour green (forestgreen) any genes with linear fold-change <= -4.0

Not sure if this helps (or even works). You can play around with the cut-offs in order to choose how you want to shade the points based on different statistical cut-off thresholds.

43kI will try your code and it will work definitely , but I have to explain my boss about the plot...It seems he doesn't understand

500Okay, I will be your new boss

43kglad i could have that opportunity may be in future

500Just hook your boss up on biostars ;)

770