statgen / locuszoom

A Javascript/d3 embeddable plugin for interactively visualizing statistical genetic data from customizable sources.
https://statgen.github.io/locuszoom/
MIT License
154 stars 29 forks source link

How to change the legend on the y-axis? #210

Closed CFB2018 closed 4 years ago

CFB2018 commented 4 years ago

Hi, I was wondering if it is possible to change the legend on the y-axis? The default is -log10 Pval. How do I go about changing that label? Thank you, Carmen

abought commented 4 years ago

There is no UI for people to do this in the web browser, but if you are creating your own custom website that uses LocusZoom.js, this can be done via the layout object (which has an awful lot of config options!)

For example, in the standard LZ association plot view, the scatter plot is the first panel (row), and the label you refer to is the left hand axis (axis y1). So by digging through the nested layout object, you'd set the configuration option you want as follows:

layout.panels[0].axes.y1 = "my custom label";

We're starting from the layout object used to render the plot (LocusZoom.populate("#plot", data_sources, layout)), and only modifying one specific field while leaving the rest unchanged. Obviously this is easier to do if you change the label before rendering the plot.

LocusZoom objects have, um, a lot of configuration options, which can be overwhelming at first. It can be helpful to explore this interactively (eg through the browser devtools console) We are actively looking to make the process of custom layouts more approachable and feedback is welcome.

CFB2018 commented 4 years ago

Ok, thank you very much for your reply. I will look in to it some more. Kind regards, Carmen

23 sep. 2020 kl. 18:59 skrev Andy Boughton notifications@github.com:

 There is no UI for people to do this in the web browser, but if you are creating your own custom website that uses LocusZoom.js, this can be done via the layout object (which has an awful lot of config options!)

For example, in the standard LZ association plot view, the scatter plot is the first panel (row), and the label you refer to is the left hand axis (axis y1). So by digging through the nested layout object, you'd set the configuration option you want as follows:

layout.panels[0].axes.y1 = "my custom label";

We're starting from the layout object used to render the plot (LocusZoom.populate("#plot", data_sources, layout)), and only modifying one specific field while leaving the rest unchanged. Obviously this is easier to do if you change the label before rendering the plot.

LocusZoom objects have, um, a lot of configuration options, which can be overwhelming at first. It can be helpful to explore this interactively (eg through the browser devtools console) We are actively looking to make the process of custom layouts more approachable and feedback is welcome.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

abought commented 4 years ago

Good luck! I'm closing this issue for now. If you have followup questions, please feel welcome to reopen the ticket as needed.