**460**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

**840**• written 12 months ago by krushnach80 •

**460**

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.0kwell 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

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

460Can you post some example data that resembles HL_60?

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

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

720well 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

460Hi 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.

37kyeah 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

460what 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

460...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.

37kyeah 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

460To 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.

37kI 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

460Okay, I will be your new boss

37kglad i could have that opportunity may be in future

460Just hook your boss up on biostars ;)

720