Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying Color Legend and Density Values in SNP Density Plot #96

Open
915813786 opened this issue Jul 2, 2023 · 3 comments
Open

Modifying Color Legend and Density Values in SNP Density Plot #96

915813786 opened this issue Jul 2, 2023 · 3 comments

Comments

@915813786
Copy link

Dear YinLiLin ,

I am currently working on generating SNP density plots using the CMplot package in R. I have successfully created the plots, but I'm facing a challenge in modifying the color legend and density values displayed in the bottom right corner of the plot.

Specifically, I would like to customize the color legend to show different colors corresponding to specific density ranges, and I also want to modify the density values displayed in the legend. Currently, the legend automatically generates breaks and labels based on the data, but I would like to manually set my own density ranges and corresponding labels.

I have reviewed the documentation and explored various options, but I couldn't find a straightforward way to achieve this customization. I would greatly appreciate your guidance on how to modify the color legend and density values in the SNP density plot using the CMplot package.

Could you kindly provide me with step-by-step instructions or sample code on how to customize the color legend and density values in the CMplot SNP density plot? Specifically, I would like to specify my own density ranges (e.g.,110,200,300,400,500.,,,like this) and assign custom colors to each range in the legend. Additionally, I would like to manually set the density values displayed in the legend instead of relying on the automatic labeling.
Thanks
CHAO

@YinLiLin
Copy link
Owner

YinLiLin commented Jul 3, 2023

Dear Chao,

Thank you for the feedback.
I am not quite sure if the current version of CMplot can meet your requirements. I will have a check, and feed back to you here once finished.

Best,
LL

@YinLiLin
Copy link
Owner

YinLiLin commented Jul 9, 2023

Hi @915813786,

I have upgraded CMplot with a new parameter "bin.breaks" to meet your requirement, please source the online script in the R terminal and have a try.

To use the desired legend breaks, please set as follows:

CMplot(pig60K, plot.type="d", bin.breaks=seq(0, 60, 10))

And if you want to get more information about the windows, use the command below:

windinfo <- CMplot(pig60K, plot.type="d", bin.size=1e6)
head(windinfo)
  Chr   Start     End Num
1   1   27137  980193  32
2   1 1001132 1982268  40
3   1 2032003 2982013  29
4   1 3002378 3985923  30
5   1 4028260 4969969  40
6   1 4996159 5989313  40

Best,
LL

@915813786
Copy link
Author

915813786 commented Jul 9, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants