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

Fixing the aspect ratio issue #7

Merged
merged 25 commits into from
Nov 17, 2021
Merged

Conversation

teunbrand
Copy link
Collaborator

@teunbrand teunbrand commented Nov 17, 2021

This took a bit of refactoring but I believe I may have solved the pernicious aspect ratio - text angle issue as mentioned in #6 .

In brief:

  • The ggproto method is no longer responsible for doing the data manipulations. Hence I moved the helpers to a different file.
  • Grob creation is now the responsibility of the textpathGrob() constructor, which we can reuse in new geoms we've been ogling.
  • The evaluation of the grob, and the measurements/placements, are now delayed until draw time.
  • Consequently, we can use absolute units instead of relying on the relative ones, which should give the right angles even under different aspect ratios and even when the device is resized.

Here is a charming picture from a bug I had at some point:

accidentalRt

@AllanCameron AllanCameron merged commit 5123ccb into AllanCameron:main Nov 17, 2021
@AllanCameron
Copy link
Owner

Excellent work Teun. This is the step that will make the whole project viable. I had been working today on trying to get makeContent to work, but couldn't get it to be called when the window was resized unless I had it defined in the global environment. I'll need to study your code to see where I was going wrong.

I'll need to incorporate a few tweaks to fix the letter spacing again: you'll notice that the spacing changes a bit as the curvature varies in the spiral example. The apparent vjust also changes. These are just details though and I'm confident I can fix these quickly.

I'm pretty excited with what we have after this. Nice to see the repo has been starred by some ggplot gurus (hrbrmstr and coolbutuseless).

@AllanCameron
Copy link
Owner

I'll also need to figure out why that text has flipped in the polar co-ordinates. Again, this looks like it should be a quick fix.

I had a very similar bug on the spiral example to the one you showed. It's quite hypnotic really!

@teunbrand teunbrand mentioned this pull request Nov 18, 2021
8 tasks
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.

None yet

2 participants