CMplot icon indicating copy to clipboard operation
CMplot copied to clipboard

How to put highlighted text just above the points?

Open YiweiNiu opened this issue 3 years ago • 10 comments

Hi Lilin,

Thanks very much for developing this useful tool.

I wonder if there is a way to add highlighed text labels right on top of the points, like this one.

image

Thank you in advance.

Bests, Yiwei

YiweiNiu avatar Apr 16 '22 07:04 YiweiNiu

Hi Yiwei,

I am not sure if it can address your issue, please try to add two parameters in CMplot, like: highlight.text.yadj=rep(1, length(N_ht)), highlight.text.xadj=rep(0, length(N_ht)), where N_ht is the number of highlighted SNPs.

Regards, Lilin

YinLiLin avatar Apr 17 '22 02:04 YinLiLin

Hi Lilin,

Thank you for your quick reply. I tried this method, but it did not work.

In highlight.text.yadj=rep(1, length(N_ht)), highlight.text.xadj=rep(0, length(N_ht)), N_ht should be the highlighted SNPs?

Otherwise it would throw an error like:

Error in highlight_text(x = pvalue.posN[highlight_index[[i]]], y = logpvalue[highlight_index[[i]]], : length of xadj not equals to length of x

Bests, Yiwei

YiweiNiu avatar Apr 19 '22 02:04 YiweiNiu

Sorry for the unclear statement, it should be rep(1, N_ht) or rep(1, length(ht). This setting only helps to initialize the start positions of labels around the highlighted points, however, if there are too many highlighted SNPs, the positions will be changed to generate non-overlapped layout.

YinLiLin avatar Apr 19 '22 02:04 YinLiLin

Hi Lilin,

Thanks a lot for your prompt reply. There were about six SNPs I wanted to highlight. Using highlight.text.yadj = rep(1, N_ht), highlight.text.xadj = rep(0, N_ht) could not generate the plot I pasted above. Maybe I will use AI to modify the final plot.

Thank you.

YiweiNiu avatar Apr 19 '22 11:04 YiweiNiu