|
| 1 | +utils::globalVariables(c( |
| 2 | + "CL1", |
| 3 | + "CL2", |
| 4 | + "color_assigned", |
| 5 | + "color_final", |
| 6 | + "color_from", |
| 7 | + "color_lineage", |
| 8 | + "color_to", |
| 9 | + "measure", |
| 10 | + "total_in", |
| 11 | + "weight" |
| 12 | +)) |
| 13 | + |
1 | 14 | #' Plot a Thematic Evolution Analysis |
2 | 15 | #' |
3 | 16 | #' It plot a Thematic Evolution Analysis performed using the \code{\link{thematicEvolution}} function. |
|
21 | 34 | #' } |
22 | 35 | #' |
23 | 36 | #' @seealso \code{\link{thematicMap}} function to create a thematic map based on co-word network analysis and clustering. |
24 | | -#' @seealso \code{\link{thematicMap}} function to perform a thematic evolution analysis. |
| 37 | +#' @seealso \code{\link{thematicEvolution}} function to perform a thematic evolution analysis. |
25 | 38 | #' @seealso \code{\link{networkPlot}} to plot a bibliographic network. |
26 | 39 | #' |
27 | 40 | #' @export |
@@ -217,11 +230,42 @@ assignEvolutionColors <- function( |
217 | 230 |
|
218 | 231 | # Initialize palette |
219 | 232 | if (is.null(palette)) { |
220 | | - library(RColorBrewer) |
221 | 233 | palette <- c( |
222 | | - brewer.pal(8, "Set2"), |
223 | | - brewer.pal(8, "Dark2"), |
224 | | - brewer.pal(8, "Accent") |
| 234 | + "#E41A1C", |
| 235 | + "#377EB8", |
| 236 | + "#4DAF4A", |
| 237 | + "#984EA3", |
| 238 | + "#FF7F00", |
| 239 | + "#A65628", |
| 240 | + "#F781BF", |
| 241 | + "#999999", |
| 242 | + "#66C2A5", |
| 243 | + "#FC8D62", |
| 244 | + "#8DA0CB", |
| 245 | + "#E78AC3", |
| 246 | + "#A6D854", |
| 247 | + "#FFD92F", |
| 248 | + "#B3B3B3", |
| 249 | + "#A6CEE3", |
| 250 | + "#1F78B4", |
| 251 | + "#B2DF8A", |
| 252 | + "#33A02C", |
| 253 | + "#FB9A99", |
| 254 | + "#E31A1C", |
| 255 | + "#FDBF6F", |
| 256 | + "#FF7F00", |
| 257 | + "#CAB2D6", |
| 258 | + "#6A3D9A", |
| 259 | + "#B15928", |
| 260 | + "#8DD3C7", |
| 261 | + "#BEBADA", |
| 262 | + "#FB8072", |
| 263 | + "#80B1D3", |
| 264 | + "#FDB462", |
| 265 | + "#B3DE69", |
| 266 | + "#D9D9D9", |
| 267 | + "#BC80BD", |
| 268 | + "#CCEBC5" |
225 | 269 | ) |
226 | 270 | } |
227 | 271 |
|
@@ -367,105 +411,3 @@ assignEvolutionColors <- function( |
367 | 411 |
|
368 | 412 | return(list(Nodes = Nodes, Edges = Edges)) |
369 | 413 | } |
370 | | - |
371 | | -# plotThematicEvolution <- function( |
372 | | -# Nodes, |
373 | | -# Edges, |
374 | | -# measure = "inclusion", |
375 | | -# min.flow = 0 |
376 | | -# ) { |
377 | | -# Kx <- length(unique(Nodes$group)) |
378 | | -# Ky <- nrow(Nodes) |
379 | | -# Nodes <- Nodes %>% |
380 | | -# mutate( |
381 | | -# coordX = rep( |
382 | | -# seq(from = 0, to = 1, by = 1 / (Kx - 0.8)), |
383 | | -# as.numeric(table(.data$group)) |
384 | | -# ), |
385 | | -# coordY = rep(0.1, Ky) |
386 | | -# ) |
387 | | -# |
388 | | -# ################ |
389 | | -# switch( |
390 | | -# measure, |
391 | | -# inclusion = { |
392 | | -# Edges = Edges[-c(4, 5)] |
393 | | -# }, |
394 | | -# stability = { |
395 | | -# Edges = Edges[-c(3, 4)] |
396 | | -# }, |
397 | | -# weighted = { |
398 | | -# Edges = Edges[, -c(3, 5)] |
399 | | -# } |
400 | | -# ) |
401 | | -# names(Edges)[3] = "weight" |
402 | | -# Edges = Edges[Edges$weight >= min.flow, ] |
403 | | -# Edges$weight = Edges$weight * 100 |
404 | | -# |
405 | | -# Nodes$id <- (1:nrow(Nodes)) - 1 |
406 | | -# |
407 | | -# ## identify and remove nodes with empty edges |
408 | | -# ind <- setdiff(Nodes$id, unique(c(Edges$from, Edges$to))) |
409 | | -# if (length(ind) > 0) { |
410 | | -# Nodes <- Nodes[-(ind + 1), ] |
411 | | -# Nodes$idnew <- (1:nrow(Nodes)) - 1 |
412 | | -# ## replace old edge ids with new ones |
413 | | -# for (i in 1:nrow(Nodes)) { |
414 | | -# old <- Nodes$id[i] |
415 | | -# new <- Nodes$idnew[i] |
416 | | -# Edges$from[Edges$from == old] <- new |
417 | | -# Edges$to[Edges$to == old] <- new |
418 | | -# } |
419 | | -# } |
420 | | -# |
421 | | -# #Edges$color <- "lightgrey" |
422 | | -# |
423 | | -# # plotly margins |
424 | | -# m <- list( |
425 | | -# l = 50, |
426 | | -# r = 50, |
427 | | -# b = 100, |
428 | | -# t = 100, |
429 | | -# pad = 4 |
430 | | -# ) |
431 | | -# |
432 | | -# plotly::plot_ly( |
433 | | -# type = "sankey", |
434 | | -# arrangement = "snap", |
435 | | -# node = list( |
436 | | -# label = Nodes$name, |
437 | | -# x = Nodes$coordX, |
438 | | -# y = Nodes$coordY, |
439 | | -# color = Nodes$color, |
440 | | -# pad = 4 |
441 | | -# ), # 10 Pixel |
442 | | -# link = list( |
443 | | -# source = Edges$from, |
444 | | -# target = Edges$to, |
445 | | -# value = Edges$weight |
446 | | -# #,color = Edges$color |
447 | | -# ) |
448 | | -# ) %>% |
449 | | -# layout(margin = m) %>% |
450 | | -# plotly::add_annotations( |
451 | | -# x = Nodes$coordX, |
452 | | -# y = 1.08, |
453 | | -# text = factor(Nodes$group), |
454 | | -# showarrow = F, |
455 | | -# xanchor = "center", |
456 | | -# font = list(color = 'Dark', family = "TimesNewRoman", size = 18) |
457 | | -# ) %>% |
458 | | -# config( |
459 | | -# displaylogo = FALSE, |
460 | | -# modeBarButtonsToRemove = c( |
461 | | -# 'toImage', |
462 | | -# 'sendDataToCloud', |
463 | | -# 'pan2d', |
464 | | -# 'select2d', |
465 | | -# 'lasso2d', |
466 | | -# 'toggleSpikelines', |
467 | | -# 'hoverClosestCartesian', |
468 | | -# 'hoverCompareCartesian' |
469 | | -# ) |
470 | | -# ) |
471 | | -# } |
0 commit comments