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

textAlong #55

Closed
fmusili opened this issue Feb 20, 2017 · 8 comments
Closed

textAlong #55

fmusili opened this issue Feb 20, 2017 · 8 comments

Comments

@fmusili
Copy link

fmusili commented Feb 20, 2017

Hi Thomas,

Am getting an error:
Error in makeContent.textalong(x) : could not find function "convertX"
Called from: makeContent.textalong(x)

Can you help?

@thomasp85
Copy link
Owner

That is strange as it should be available (it is imported from grid in the namespace file)

Can I get you to try and install the latest GitHub version, and if the problem persists, try to load grid
explicitly (library(grid)) and see if that helps. If there's still a problem I would like to get a minimal reproducible example along with your session info...

@fmusili
Copy link
Author

fmusili commented Feb 20, 2017 via email

@thomasp85
Copy link
Owner

Hmm... It still shouldn't do that - can you share the error producing code along with your session info

@fmusili
Copy link
Author

fmusili commented Feb 20, 2017

############# error producing code
library(dplyr)
library(ggplot2)
library(ggraph)
library(ggiraph)
library(igraph)
library(ggnetwork)

Commodity = c("Oranges","Oranges","Passion","Meat","Oranges","Oranges","Bananas","Cucumber"," Maize" )
from = c("Kenya","Kenya","Kenya","Kenya","Kenya","Kenya","Kenya","Kenya","Kenya")
to = c( "China","Egypt","Zambia","Japan","Rwanda","Uganda","Egypt","Japan","Uganda")
edges = data.frame(Commodity, from, to)
edges<-edges%>%group_by(from,to)%>%
summarise(Com = toString(unique(Commodity)))
vertices<-unique(rbind(data.frame(name=edges$from,Legend="Source",Commodity=""),
data.frame(name=edges$to,Legend="Destination",Commodity=edges$Com)))
g <- graph_from_data_frame(edges, directed=TRUE,vertices=vertices)
V(g)$label<-as.character(V(g)$name)
V(g)$tooltip <- paste(unique(as.character(V(g)$name)),"\n","(",V(g)$Commodity,")")

gg_point_1 <-ggraph(g, layout = 'igraph',algorithm = 'kk')+
geom_edge_link(aes(x = x, y = y,label= V(g)$label[-(1:1)]),
arrow = arrow(length = unit(4, "mm"), type = "closed"),
label_colour = "blue",
angle_calc = 'along',
label_dodge = unit(2.5, 'mm'),
end_cap = circle(3, 'mm')) +
geom_node_point(size =5 ,color = "red")+
theme_blank() +
geom_point_interactive(aes(x = x, y = y,tooltip=tooltip,color=Legend),size=7)+
ggtitle(paste0("Title"))+
scale_color_brewer(palette="Dark2")+
theme(plot.title = element_text(color="darkblue", size=13, face="bold"))
ggiraph(code = print(gg_point_1 ),zoom_max = 3,width = 0.9,width_svg = 9,
height_svg = 8)

######## sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X El Capitan 10.11.4

locale:
[1] C

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

other attached packages:
[1] gdtools_0.1.3 ggnetwork_0.5.1 igraph_1.0.1 ggiraph_0.3.2.9000 ggraph_0.1.1 ggplot2_2.2.1
[7] dplyr_0.5.0 raster_2.5-8 sp_1.2-4

loaded via a namespace (and not attached):
[1] Rcpp_0.12.9 sna_2.4 RColorBrewer_1.1-2 plyr_1.8.4 R.methodsS3_1.7.1
[6] R.utils_2.5.0 tools_3.3.2 digest_0.6.12 tibble_1.2 gtable_0.2.0
[11] lattice_0.20-34 DBI_0.5-1 ggrepel_0.6.5 xml2_1.1.1 htmlwidgets_0.8
[16] grid_3.3.2 R6_2.2.0 rvg_0.1.2 tweenr_0.1.5 deldir_0.1-12
[21] udunits2_0.13 magrittr_1.5 scales_0.4.1 htmltools_0.3.5 MASS_7.3-45
[26] units_0.4-2 assertthat_0.1 ggforce_0.1.1 colorspace_1.3-2 labeling_0.3
[31] network_1.13.0 lazyeval_0.2.0 munsell_0.4.3 statnet.common_3.3.0 R.oo_1.21.0

@thomasp85
Copy link
Owner

Hmm... I cannot reproduce. Can I get you to test if you get the error when you run the code without ggiraph calls?

@fmusili
Copy link
Author

fmusili commented Feb 20, 2017

It works fine without ggiraph calls.

@thomasp85
Copy link
Owner

There's some strangeness going on in that interaction then. As it is solved by loading grid I won't look more into it now as ggraph itself works, but might look further when time permits

@fmusili
Copy link
Author

fmusili commented Feb 20, 2017

Ok, thank you!

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

2 participants