Skip to content

Commit 94b925c

Browse files
committed
Minor fixes
1 parent 1af2f96 commit 94b925c

File tree

2 files changed

+50
-108
lines changed

2 files changed

+50
-108
lines changed

R/plotThematicEvolution.R

Lines changed: 49 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
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+
114
#' Plot a Thematic Evolution Analysis
215
#'
316
#' It plot a Thematic Evolution Analysis performed using the \code{\link{thematicEvolution}} function.
@@ -21,7 +34,7 @@
2134
#' }
2235
#'
2336
#' @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.
2538
#' @seealso \code{\link{networkPlot}} to plot a bibliographic network.
2639
#'
2740
#' @export
@@ -217,11 +230,42 @@ assignEvolutionColors <- function(
217230

218231
# Initialize palette
219232
if (is.null(palette)) {
220-
library(RColorBrewer)
221233
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"
225269
)
226270
}
227271

@@ -367,105 +411,3 @@ assignEvolutionColors <- function(
367411

368412
return(list(Nodes = Nodes, Edges = Edges))
369413
}
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-
# }

man/plotThematicEvolution.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)