open2c / coolpuppy

A versatile tool to perform pile-up analysis on Hi-C data in .cool format.
MIT License
77 stars 11 forks source link

[Q]why is the middle value not in the center of the color bar #121

Closed jiangshan529 closed 1 year ago

jiangshan529 commented 1 year ago

As mentioned in the question title, I noticed that the middle value is not in the center of the color bar. Is there a reason for this? Is that log-normalized? Thanks!

image

efriman commented 1 year ago

Depends on how you do the plotting. This will happen if you use '--non-symmetrical --vmax 1.5 --vmin 0.5'. If you want it to be in the center you need to plot symmetrically. By default it's log, otherwise you need to use '--scale linear'

Elias

jiangshan529 commented 1 year ago

Depends on how you do the plotting. This will happen if you use '--non-symmetrical --vmax 1.5 --vmin 0.5'. If you want it to be in the center you need to plot symmetrically. By default it's log, otherwise you need to use '--scale linear'

Elias

Hi, Elias. How should I plot this symmetric? When I use '--symmetric', it reports "plotpup.py: error: unrecognized arguments: --symmetric"

efriman commented 1 year ago

Hi, By default it's symmetrical and log. Can you show the output of plotpup.py without specifying scale or vmax/vmin (with the whole command)?

jiangshan529 commented 1 year ago

Hi, By default it's symmetrical and log. Can you show the output of plotpup.py without specifying scale or vmax/vmin (with the whole command)?

Hi, by not specifying scale or vmax/vmin, the plot looks correct with 1 in the middle of the color bar. But I really want to set the vmin and vmax for my plot and with 1 in the middle, what can I do? Thanks!

efriman commented 1 year ago

I think I fixed this rare bug.

You can update to that fork or just edit it yourself (just a few lines in plotpup.py). Let me know how it goes https://github.com/efriman/coolpuppy/commit/30a6fbdfe2ac3926c44becf0e80f279e9df14dee

jiangshan529 commented 1 year ago

I think I fixed this rare bug.

You can update to that fork or just edit it yourself (just a few lines in plotpup.py). Let me know how it goes efriman@30a6fbd

Hi, Elias. Thanks for your suggestion. I have revised the script according to your code. And there's still such a problem: 1 is not in the center of the color bar.

" (base) bai@WP6FC-B6E:$ plotpup.py --input_pups aa_250pad.txt --vmin 0.7 --vmax 1.3 --font_scale 0.5 --output aa_local16.pdf --scale log INFO:coolpuppy:Can't set both vmin and vmax and get symmetrical scale. Plotting non-symmetrical " image

Phlya commented 1 year ago

This makes sense, in log scale 1 is not in the center between 0.7 and 1.3. Set --scale linear, it will be in the center.

efriman commented 1 year ago

Yeah the bug was only for the lower tick not plotting when set automatically, which is different. That looks correct

jiangshan529 commented 1 year ago

This makes sense, in log scale 1 is not in the center between 0.7 and 1.3. Set --scale linear, it will be in the center.

Hi, Thanks! Solved it!