Skip to content

Log scales for plots#251

Draft
JamesWiresmith wants to merge 7 commits into
emilk:mainfrom
JamesWiresmith:log_scales
Draft

Log scales for plots#251
JamesWiresmith wants to merge 7 commits into
emilk:mainfrom
JamesWiresmith:log_scales

Conversation

@JamesWiresmith

Copy link
Copy Markdown

This is a draft PR for adding log scales to the plots. I've taken a different route to others that I feel will help with future maintenance and issues but happy to defer to other solutions that get the feature in.

The first changes extract the axis space mapping from the transform as a separate axis space. This encapsulates the mapping and allows a common interface that other axis space must add.

The abstraction has been adjusted to remove assumptions of linear space in other functions.

Finally the log space has been added, using a nested linear space for the exponent of the input values meaning we can reuse much of that mapping.

The reason it is still a draft is:

  • It is obviously large and I wanted to give an earlier chance for review.
  • I need to work out the sensible option for the base step size in the grid input. I'm struggling to understand how to set this on a log plot.
  • There is an error with the drag delta as for log we need a start position due to it being non-linear and the start position returns an option so it needs handling when that is None.

Separated the axis logic from the transform logic in preparation for
being able to support log axis. This still has cases that won't work as
an API for log axis but provides a starting point with all tests
passing.

Failing tests on drawing grid lines and marks though.
Got the basics of log scale working with an inner linear scale based on
the exponent. Now need to handle the more complex transforms.
Looked to remove it - in most cases was just used to define a sensible
minimum - but some tests have broken so still need to review
* Looked at the usage of the linear scales and attempted to abstract
  better domain methods.
Still some issues to work out related to scaling, the demo shows a
memory issue which I need to understand. Something related to line
generation I think
Nearly working but we get an error due to having to handle the option of
a pointer co-oridnate on a drag.

Also need to work out the base spacing
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

View snapshot changes at kitdiff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant