Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

arrow() in ggplot2 no longer supported

Tags:

r

ggplot2

r-grid

Installed R 2.15.2 on a new machine and ggplot2. The grid package is no longer supported in this latest version of R, but ggplot2 uses grid for the arrow() function, as in these examples.

http://docs.ggplot2.org/current/geom_segment.html

Haven't been able to find a workaround. Any suggestions?

like image 795
user2037931 Avatar asked Feb 03 '13 20:02

user2037931


People also ask

What is %>% in ggplot?

%>% is a pipe operator reexported from the magrittr package. Start by reading the vignette. Introducing magrittr. Adding things to a ggplot changes the object that gets created. The print method of ggplot draws an appropriate plot depending upon the contents of the variable.

Can you filter in ggplot?

ggplot2 allows you to do data manipulation, such as filtering or slicing, within the data argument.

Does ggplot only work with data frames?

ggplot only works with data frames, so we need to convert this matrix into data frame form, with one measurement in each row. We can convert to this “long” form with the melt function in the library reshape2 . Notice how ggplot is able to use either numerical or categorical (factor) data as x and y coordinates.


1 Answers

Maybe you think that grid is no more supported because of the message displayed on its CRAN page ? But if it is written that Package ‘grid’ was removed from the CRAN repository, it is because it is now part of the base R distribution, as mentioned on Paul Murrell's grid page.

So library(grid) and the arrow function should work fine.

Some of the confusion may be due to the fact that grid was loaded automatically by previous versions of ggplot (making grid functions visible/accessible to the user); now it's referred to via NAMESPACE imports instead, so you need to explicitly load grid if you want to use grid functions (or look at their help pages).

like image 98
juba Avatar answered Sep 30 '22 19:09

juba