Hi,
i've a grafic with cluster of words but the distance is to far between the clusters.
How can i reduce the distance?My example:
structure(
list(
haw = c(
"Heilbronn",
"Dortmund",
"Heilbronn",
"Heilbronn",
"Dortmund",
"Mannheim",
"OTHR",
"Trier",
"Dortmund",
"Heilbronn",
"Dortmund",
"Dortmund",
"Dortmund",
"Heilbronn",
"Trier",
"Braunschweig",
"OTHR",
"Braunschweig",
"Braunschweig",
"Dortmund",
"Dortmund",
"Dortmund",
"Dortmund",
"Dortmund",
"Dortmund",
"Dortmund",
"Heilbronn",
"OTHR",
"OTHR",
"Braunschweig",
"Braunschweig",
"Braunschweig",
"Braunschweig",
"Dortmund",
"Dortmund",
"Dortmund",
"Heilbronn",
"Heilbronn",
"Heilbronn",
"Heilbronn",
"Heilbronn",
"Heilbronn",
"Heilbronn",
"Trier"
),
words = c(
"fachkompetenz",
"kompetenzen",
"kompetenzniveau",
"kompetenz",
"methodenkompetenz",
"kompetenzen",
"kompetenzen",
"kompetenzen",
"sozialkompetenz",
"sozialkompetenz",
"selbstkompetenz",
"fachkompetenz",
"kompetenz",
"kompetenzen",
"kompetenz",
"kompetenzen",
"schlüsselkompetenzen",
"kompetenz",
"methodenkompetenzen",
"analysekompetenz",
"einsatzkompetenz",
"methodenkompetenzen",
"organisationskompetenz",
"realisierungskompetenz",
"systemkompetenz",
"vernetzungskompetenz",
"kompetenzklassen",
"fremdsprachenkompetenzen",
"internetkompetenz",
"anwendungskompetenze",
"lernkompetenz",
"methodenkompetenz",
"synthesekompetenzen",
"kompetenzarten",
"sachkompetenz",
"sozialkompetenzen",
"dialogkompetenz",
"kompetenzorientiert",
"kompetenzprofil",
"problemlösekompetenz",
"problemlösungskompetenz",
"sozialkompetenzen",
"wissenserwerbskompetenzen",
"problemlösungskompetenzen"
),
n = c(
163L,
91L,
90L,
86L,
83L,
75L,
66L,
42L,
41L,
34L,
13L,
8L,
8L,
5L,
5L,
4L,
4L,
3L,
2L,
2L,
2L,
2L,
2L,
2L,
2L,
2L,
2L,
2L,
2L,
1L,
1L,
1L,
1L,
1L,
1L,
1L,
1L,
1L,
1L,
1L,
1L,
1L,
1L,
1L
),
kompetenz = c(
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE
)
),
class = c("grouped_df",
"tbl_df", "tbl", "data.frame"),
row.names = c(NA,-44L),
groups = structure(
list(
haw = c(
"Braunschweig",
"Dortmund",
"Heilbronn",
"Mannheim",
"OTHR",
"Trier"
),
.rows = list(
c(16L, 18L, 19L, 30L, 31L,
32L, 33L),
c(
2L,
5L,
9L,
11L,
12L,
13L,
20L,
21L,
22L,
23L,
24L,
25L,
26L,
34L,
35L,
36L
),
c(1L, 3L, 4L, 10L, 14L, 27L,
37L, 38L, 39L, 40L, 41L, 42L, 43L),
6L,
c(7L, 17L, 28L, 29L),
c(8L, 15L, 44L)
)
),
row.names = c(NA,-6L),
class = c("tbl_df",
"tbl", "data.frame"),
.drop = TRUE
)
)
library(igraph)
library(ggraph)
bigrams_kompetenz %>%
filter(n > 1) %>% filter(grepl('OTHR|Trier|Braunschweig|Mannheim',haw)) %>%
graph_from_data_frame() %>%
ggraph(layout = "fr") +
geom_edge_link(aes(alpha = n, width = n)) +
geom_node_point(size = 6, color = "lightblue") +
#scale_edge_width_continuous(range=c(0.1,5.5))+
geom_node_text(aes(label = name), repel = TRUE, size=6) +
theme_void()