Skip to content

Examples for plotmath expressions in annotate #1553

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 1 commit into from
Jul 31, 2016

Conversation

dgromer
Copy link
Contributor

@dgromer dgromer commented Feb 21, 2016

Adding two examples to the documentation of annotate about how to pass plotmath expressions.

  1. simple plotmath expression
  2. mixing plotmath syntax and plain text using paste

See #1548.

#'
#' p + annotate("text", x = 4, y = 25, label = "italic(R) ^ 2 == 0.75",
#' parse = TRUE)
#' p + annotate("text", x = 4, y = 25,
Copy link
Member

Choose a reason for hiding this comment

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

What does this variation do?

Copy link
Contributor Author

@dgromer dgromer Jul 31, 2016

Choose a reason for hiding this comment

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

It shows that plain text can be mixed with plotmath expressions.

Using plotmath alone, it would not be possible to trim the leading zero of the r-squared statistic (as .75 is automatically printed as 0.75). In Psychology (according to the publication manual of the American Psychological Association) values that can't exceed 1 are typically printed without leading zero.

@hadley hadley merged commit 5726d87 into tidyverse:master Jul 31, 2016
@hadley
Copy link
Member

hadley commented Jul 31, 2016

Got it - thanks!

@lock
Copy link

lock bot commented Jan 18, 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 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants