biosustain / shu

Multi-dimensional, trans-omics metabolic maps.
https://biosustain.github.io/shu
Apache License 2.0
41 stars 1 forks source link

Rework scale adjustment of histograms #11

Closed carrascomj closed 1 year ago

carrascomj commented 1 year ago

Description

There are two kind of hist-like geoms:

In the case of side histograms, the appearance is right (leaving out edge cases where the direction has not been properly inferred). However, x-scaling makes it very tricky to put text with extra information on the histogram, like a number for the mean and axis. In the hover case, this is fundamentally wrong, since initial x-size depends on the data. The hover should have a fixed size, instead of a fixed scale.

Solutions

There are two solutions.

The first is to stop scaling and draw the histogram with proper x-size, calculated prior to the path construction. This makes it easy two add things on top and the intention of having the size (and not the scale) to some value is better expressed.

The second is to calculate the scale for x given the final desired size. To account for text scaling, each child transform has to be updated accordingly to $\frac {1}{scale}$.

An hybrid will be needed. I think is better to avoid scaling as much as possible but y-scaling is unavoidable to have comparable scales between histogram and to have it as a parameter.

carrascomj commented 1 year ago

The last paragraph was implemented in #12.