YinLiLin / CMplot

📊 Circular and Rectangular Manhattan Plot
499 stars 111 forks source link

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

Open 915813786 opened 1 year ago

915813786 commented 1 year ago

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 commented 1 year ago

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 commented 12 months ago

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 commented 12 months ago

Dear Li/李,

Thanks so much, I'll try it right away. Thanks again, I will let you know as soon as I succeed

chao 超 best wishes

发自我的iPhone

------------------ Original ------------------ From: Lilin Yin @.> Date: Sun,Jul 9,2023 4:57 PM To: YinLiLin/CMplot @.> Cc: CHAO FANG @.>, Mention @.> Subject: Re: [YinLiLin/CMplot] Modifying Color Legend and Density Values inSNP Density Plot (Issue #96)