Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement - log axes? #36

Open
nasamaher opened this issue Mar 4, 2022 · 3 comments
Open

Enhancement - log axes? #36

nasamaher opened this issue Mar 4, 2022 · 3 comments

Comments

@nasamaher
Copy link

Are there any plans for supporting logarithmic axes? (base 10 is fine).

@hageldave
Copy link
Owner

hageldave commented Mar 4, 2022

No plans so far.

I've been thinking about it for a bit though. At the moment we're building ready to use plot classes (e.g. scatter plot, line chart) that are backed by a data model. We could easily sneak in a nonlinear coordinate transform bewteen the data model and the displayed primitives (Lines, Points and so on). You can also do that yourself in a preprocessing of course in the current API, but in both cases the axis tick and label generator has to be made aware of this, so that the coordinate system shows correct and also useful ticks and guiding lines.

We'll have to put some more thought into this before jumping to implementation, but in the meantime you can do the log transform of your data manually, and interpret tick values as 10^(shown number). Or if you like to play around, you can implement a TickMarkGenerator and set it like so: coordsys.setTickMarkGenerator(tickGen).

@hageldave
Copy link
Owner

I've been thinking about this some more and I think we cannot provide a switch for automatic log-scaling as it would require transforming data deep in the rendering pipe, meaning at a very low level probably during rendering in shaders. I'd rather not touch that and instead require that data is log transformed already, i.e. the coordinates of primitives (lines, points, triangles, and so on) are already in log scale.

The missing piece is then axis tick mark placement and labelling according to the underlying transfrom. Similar to time axis labeling, the coordinate values have to be interpreted/translated into what they actually mean, for log scale that would be something like xTickLabel = e^(xCoordValue). So we'll need a TickMarkGenerator that eats the information about the log transform in place and generates reasonable tick marks that show the log characteristic (e.g. with decreasing spacing |........|....|..|.|) .

Of course any interaction with the plot e.g. range or point selection has to take the log-scale into account, which needs to be taken care of by devs using JPlotter. On a coarser abstraction level, i.e. the yet to be released ready-to-use scatterplot or linechart class, we could make an extension for log scales and also provide methods that account for the transfrom. However, this is thought is already three steps ahead of where we currently are.

@nasamaher
Copy link
Author

So I did my own log scaling before plotting and it is quite acceptable. Sorry, I should have updated this issue. No log ticks needed for me. Feel free to close.

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

No branches or pull requests

2 participants