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

vjust support #148

Open
5 tasks
tdhock opened this issue Apr 16, 2016 · 1 comment
Open
5 tasks

vjust support #148

tdhock opened this issue Apr 16, 2016 · 1 comment

Comments

@tdhock
Copy link
Owner

tdhock commented Apr 16, 2016

  • a test for values of 0, 0.5, 1-- draw an hline at say y=5, then draw some text at x=1,2,3 and y=5 with vjust=0,0.5,1. Test that bounding box of text element is on either side or in the middle of the bounding box for the hline.
  • similar test for hjust.
  • use the measureText JS function to get the height and width of a text element, and use that to compute vjust.
  • also use that for hjust instead of text-anchor property.
  • also use that for text elements that are not geoms, for example axis tick labels.
@tdhock
Copy link
Owner Author

tdhock commented Apr 16, 2016

line.df <- data.frame(just=c(0, 0.5, 1))
text.df <- expand.grid(
  vjust=line.df$just,
  hjust=line.df$just)
gg.lines <- ggplot()+
  theme_bw()+
  geom_vline(aes(xintercept=just), data=line.df, color="grey")+
  geom_hline(aes(yintercept=just), data=line.df, color="grey")
gg.vjust <- gg.lines+
  ggtitle("animint does not support aes(vjust)")+
  geom_text(aes(hjust, vjust, label="qwerty", hjust=hjust, vjust=vjust),
            data=text.df)
no.vjust <- gg.lines+
  ggtitle("workaround: no aes(vjust), add to y")+
  geom_text(aes(hjust, vjust + (0.5-vjust)*0.03 - 0.01,
                label="qwerty", hjust=hjust),
            data=text.df)
viz.just <- list(
  vjust=gg.vjust,
  workaround=no.vjust)
viz.just
structure(viz.just, class="animint")

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

No branches or pull requests

1 participant