Entering edit mode
7.0 years ago
1769mkc
★
1.2k
I have data set between two comparison or two condition such as HSC and CMP , so i want to do a scatter plot with along with the regression value. Meanwhile when i m trying to label the sample they are all labelled into same color , i want different color for the labelling so that it can be distinguished
Here is my sample data set
gene HSC CMP
ENSG00000158292.6 1.8102636 2.456869
ENSG00000162496.6 2.6796705 6.203838
ENSG00000117115.10 3.4509115 5.555739
ENSG00000159423.14 3.6809277 5.063446
ENSG00000053372.4 5.7089974 6.851090
ENSG00000127423.8 4.4894292 5.996304
ENSG00000242125.3 10.6258802 11.715932
Here is my code
library("ggpubr")
ggscatter(data1, x = "HSC", y = "CMP",
add = "reg.line", conf.int = FALSE,
cor.coef = TRUE, cor.method = "pearson",
color = "black", size=1)
Any suggestion or help would be highly appreciated
I tried that too...
what is the variabl "variable" ? I do not see it in your original question.
The variable is after i melt the data
I edited my answer. So each point will be colored relative to the "variable" variable.
Or am I melting the data in a wrong way perhaps ?
Maybe you question is not clear. You want a scatterplot where each point is colored based on a variable (in this case defined in the "variable" column). If yes then my answer should work.
so i wanted that if lets say i have a sample called HSC so all the genes which are from HSC should have different color and same with the other sample .I second code i posted is different from the first one i get the variable column after I melt the dataframe .
I thought all genes were found in the two samples ? You could add an additional column to check if the gene is found in the sample of interest (so > 0).
and then
yes the genes are common to both the samples .
ok so the answer in my comment just above is ok for you ?
yes it works ,is there a way to display R^2 and to add to it lets say i want to label my data point based on the gene names after certain threshold ? For example if the difference between two point is > 1 or 2 I want highlight or label the point