Skip to content

Clarify geom_label documentation #2782

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

Merged
merged 2 commits into from
Jul 31, 2018

Conversation

gregrs-uk
Copy link
Contributor

Specify non-support of 'angle aesthetic' rather than 'rot parameter', as this is clearer.

It is indeed the case that the angle aesthetic isn't supported. You can see below that geom_text is rotated but geom_label isn't, despite the same aesthetics. Perhaps it's worth adding a warning if you try to use the angle aesthetic with geom_label, although I'm less sure how you'd go about this.

Do I need to render the file for the man/ directory?

library(tidyverse)
#> Warning: package 'dplyr' was built under R version 3.5.1

data <- tibble(
  text = c('one', 'two', 'three'),
  angle = c(0, 45, 90),
  x = c(1, 2, 3)
)

ggplot(data, aes(x)) +
  geom_text(aes(y = 2, label = text, angle = angle)) +
  geom_label(aes(y = 1, label = text, angle = angle))

Created on 2018-07-27 by the reprex
package
(v0.2.0).

Non-support of ‘angle aesthetic’ rather than ‘rot parameter’
Copy link
Collaborator

@dpseidel dpseidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! rot is the name of the argument to grid::textGrob() that angle informs internally but this wouldn't be clear to most users. Thanks!

@dpseidel
Copy link
Collaborator

Can you rebuild the documentation and commit the new .Rd file please ? Then we are good to merge.

@clauswilke
Copy link
Member

I'm all for fixing the documentation so it agrees with what the code does and I support this PR. However, maybe we should also think about adding the ability to rotate labels? Shouldn't be that hard.

@gregrs-uk
Copy link
Contributor Author

Thanks @clauswilke. Shall I create a separate issue for this?

@gregrs-uk
Copy link
Contributor Author

gregrs-uk commented Jul 28, 2018

When I run devtools::document(), I get a lot of errors like Warning: @eval [geom-polygon.r#9]: unknown tag and git shows that the 'Aesthetics' sections have been removed from the .Rd files. Am I doing something wrong? I can call the rd_aesthetics function successfully manually, however. I'm running roxygen2 ver. 6.0.1 rather than 6.0.1.9000 if that makes a difference…

I've only committed the relevant lines of geom_text.Rd so this shouldn't pose a problem in this case.

@batpigandme
Copy link
Contributor

I'm running roxygen2 ver. 6.0.1 rather than 6.0.1.9000 if that makes a difference…

It does! The new version of roxygen should be on CRAN soon.

@gregrs-uk
Copy link
Contributor Author

Thanks @batpigandme. I've installed the latest version via devtools::install_github('klutometis/roxygen') which has sorted the eval errors. There are still loads of changes shown by git diff but I think they're mostly line-length related whitespace changes.

Still my little change should be fine as I've only committed the relevant lines.

@clauswilke
Copy link
Member

I'll make an issue for improvements in geom_label(). I think there's some other things that need improvement also, but I need to investigate first.

@clauswilke
Copy link
Member

Issue filed (#2785).

@dpseidel dpseidel merged commit 0770163 into tidyverse:master Jul 31, 2018
@gregrs-uk gregrs-uk deleted the gregrs-geom_label-doc branch July 31, 2018 20:19
@lock
Copy link

lock bot commented Jan 27, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Jan 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants