POC: no hardcoded position scales #6080
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR explores #3898.
Briefly, it un-hardcodes the x/y position aesthetics to allow for other aesthetics.
For now, consider this PR a probe into feasibility, rather a fully fledged fix. The main gripe I have with the implementation at the time of writing, is that a lot of method signatures need to be changed to accommodate an arbitrary number of position scales, instead of just x/y. That said, I don't think these are very popular methods to edit in extensions, so it needn't be too bad.
Just to demonstrate that this PR works and we can use other position scales, I've drafted a quick coord that does a perspective transform on x,y,z-coordinate data. Plot decoration such as axes and gridlines aren't implemented properly. In the details tab is the implemention of
coord_3d()
andscale_z_continuous()
, for the curious among us.The premise is that with normal Cartesian coords, you have your classic two dimensions. Here I'm adapting an example from
?persp
to demonstrate.With our new coord, we can pull the
z
aesthetic into a 3rd dimension, and project the 3D coordinates back to the x/y plane.Please note that the coord has no notion of depth, so if we were to do this with polygons instead of lines, the overlap would be all wrong.
To show that it can change perspective, let's change the
phi
(colatitude).To show that it responds to a z-scale:
Created on 2024-09-05 with reprex v2.1.1
I have no idea how well this would work for using 1D->2D transformation.