viewport

385 views
Skip to first unread message

Sorn....@dpi.vic.gov.au

unread,
Jan 4, 2010, 9:48:25 PM1/4/10
to ggp...@googlegroups.com

Hi,

I am following Hadley Wickham's code from his book on ggplot2 on page 152. I tried to create the following viewports but got the error messages (see below)

# A viewport in the top right
vp4 <- viewport(x = 1, y = 1, just = c("top", "right"))
# Bottom left
vp5 <- viewport(x = 0, y = 0, just = c("bottom", "right"))


Error Messages

> vp4 <- viewport(x = 1, y = 1, just = c("top", "right"))
Error in valid.charjust(just) : Invalid horizontal justification
> # Bottom left
> vp5 <- viewport(x = 0, y = 0, just = c("bottom", "right"))
Error in valid.charjust(just) : Invalid horizontal justification

I am using R 2.10.0

Thank you for your help.

Cheers

Sorn

Notice:
This email and any attachments may contain information that is personal, confidential,
legally privileged and/or copyright.
No part of it should be reproduced, adapted or communicated without the prior written consent of the copyright owner.

It is the responsibility of the recipient to check for and remove viruses.

If you have received this email in error, please notify the sender by return email, delete it from your system and destroy any copies. You are not authorised to use, communicate or rely on the information contained in this email.

Please consider the environment before printing this email.

 

 

 

Dennis Murphy

unread,
Jan 4, 2010, 10:20:43 PM1/4/10
to Sorn....@dpi.vic.gov.au, ggp...@googlegroups.com
Works for me after switching the labels in just():

> (a <- qplot(date, unemploy, data = economics, geom = "line"))
> (b <- qplot(uempmed, unemploy, data = economics) +
+   geom_smooth(se = F))
> (c <- qplot(uempmed, unemploy, data = economics, geom="path"))
>
> # A viewport that takes up the entire plot device
> vp1 <- viewport(width = 1, height = 1, x = 0.5, y = 0.5)
> vp1 <- viewport()
>
> # A viewport that takes up half the width and half the height,
> # located in the middle of the plot.
> vp2 <- viewport(width = 0.5, height = 0.5, x = 0.5, y = 0.5)
> vp2 <- viewport(width = 0.5, height = 0.5)
>
> # A viewport that is 2cm x 3cm located in the center
> vp3 <- viewport(width = unit(2, "cm"), height = unit(3, "cm"))

>
> # A viewport in the top right
> vp4 <- viewport(x = 1, y = 1, just = c("right", "top"))
> # Bottom left
> vp5 <- viewport(x = 0, y = 0, just = c("right", "bottom"))

[dump to pdf file omitted]

> sessionInfo()
R version 2.10.1 Patched (2010-01-01 r50884)
i386-pc-mingw32

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252  
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                         
[5] LC_TIME=English_United States.1252   

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods 
[8] base    

other attached packages:
[1] ggplot2_0.8.5 digest_0.4.2  reshape_0.8.3 plyr_0.1.9    proto_0.3-8 

loaded via a namespace (and not attached):
[1] tools_2.10.1


 

 

--
You received this message because you are subscribed to the ggplot2 mailing list.
To post to this group, send email to ggp...@googlegroups.com
To unsubscribe from this group, send email to
ggplot2+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/ggplot2

Sorn....@dpi.vic.gov.au

unread,
Jan 4, 2010, 10:26:30 PM1/4/10
to Dennis Murphy, ggp...@googlegroups.com

Thanks Dennis. It works for me as well now after making the switch in just().




Dennis Murphy <djm...@gmail.com>
Sent by: ggp...@googlegroups.com

05/01/2010 02:20 PM

To
Sorn....@dpi.vic.gov.au
cc
ggp...@googlegroups.com
Subject
Re: viewport


Reply all
Reply to author
Forward
0 new messages