Skip to content

Clarify geom_label documentation - #2782

Merged
dpseidel merged 2 commits into
tidyverse:masterfrom
gregrs-uk:gregrs-geom_label-doc
Jul 31, 2018
Merged

dpseidel merged 2 commits into
tidyverse:masterfrom
gregrs-uk:gregrs-geom_label-doc

Conversation

@gregrs-uk

Copy link
Copy Markdown
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’

@dpseidel dpseidel left a comment

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator

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

@clauswilke

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

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

@gregrs-uk

gregrs-uk commented Jul 28, 2018 •

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

lock Bot commented Jan 27, 2019

Copy link
Copy Markdown

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