3/9/2023 0 Comments Write graph rHere you will notice x label, y label has not been assigned, so the default names as came. Plot(Vec,type = "o") # Plot the bar chart. Simple Line Graph in R code (with Plot function): However, for ggplot, the library “ggplot2” needs to be installed and read that library like: “library(ggplot2)” in the R environment.įor installation in RStudio. For plot(), one need not install any library. If (endsWith(x = filename, suffix = ".The first function we will learn is plot() and another one would be ggplot. Text(min_x, pos_text, paste0("TP: ", TPs)) Pos_text < - mean(range(g_mod$layout[cl_vertex$TP = Pos_l < - mean(c(range_Y_curr, range_Y_next)) Range_Y_next < - range(g_mod$layout[cl_vertex$TP = Range_Y_curr < - range(g_mod$layout[cl_vertex$TP = Min_x < - ifelse(test = min_x < 0, yes = min_x * 1.3, Names(time_point_grp)), fill = RColorBrewer::brewer.pal(9, Legend(x = legend_position, legend = paste0("Time Point ", Plot(g_mod, rescale = FALSE, = label.cex, "Pastel1"), as.hexmode(round(tp_mark_alpha *Ģ55))), rescale = FALSE, = label.cex,Į = label.cex, = 0) Mark.border = 0, l = paste0(RColorBrewer::brewer.pal(9, Plot(g_mod, oups = time_point_grp, mark.shape = 1, G_mod$layout < - igraph::norm_coords(as.matrix(cl_vertex), xmin = -1 * ratio, xmax = 1 * Time_point_grp < - split(cl_vertex$names[cl_vertex$last_mutation != G_mod < - igraph::graph_from_data_frame(d = cl_edges, directed = TRUE, Labels_show = labels_show, label_offset = label_offset)Ĭl_vertex < - cl_df$cl_vertex[order(cl_df$cl_vertex$TP, cl_df$cl_vertex$coord.y), Xc = Xc, Yc = Yc, cl_df = cl_df, adjMatrix_base = adjMatrix_base,ĪdjMatrix_overall = adjMatrix_overall, mut_TP = mut_TP, Idx_next_v < - which(colSums(adjMatrix_overall != 0) = 0)Ĭl_df < - recursiveLongitudinalLayout(idx_Vc = idx_next_v, Mut_TP < - cumsum(mut_TP) 1:length(mut_TP)Ĭl_df < - list(cl_vertex = cl_vertex, cl_edges = cl_edges) Max_deep_tp < - max(max_deep_tp, deep_tmp) Ind_lPath = 1, mut_list = NA, row_v = idx)ĭeep_tmp < - recursiveDescend(descend)$max_deep Idx_anc_c < - which(colSums(adjMatrix_base_tp) =ĭescend = list(adjM = adjMatrix_base_tp, l_path = 0, Storage.mode(adjMatrix_overall) < - "integer"Ĭol_in < - which(colnames(adjMatrix_base) %in% cl_edges$name[cl_edges$to %in%ĪdjMatrix_base_tp < - adjMatrix_base G < - igraph::graph_from_data_frame(cl_edges, directed = TRUE,ĪdjMatrix_overall < - igraph::get.adjacency(g, sparse = F,ĪdjMatrix_overall < - 0ĪdjMatrix_overall < - 2ĪdjMatrix_overall < - 1 Igraph::delete_edge_attr(graph = g, name = "extincion") Igraph::vertex_attr(graph = g, name = "color") < - cl_vertex$color Igraph::vertex_attr(graph = g, name = "branch_level") < - cl_vertex$branch_level Igraph::vertex_attr(graph = g, name = "branch") < - cl_vertex$branch N_levels < - max(cl_vertex$branch_level < - "#C0C0C0"Ĭl_vertex$color < - "#DDDDDD" Parental_clones < - c(parental_clones, c_son) Igraph::write_graph(data, file = con, format = "graphml")Ĭat(paste0("Error writing: ", path, "\n", e))Ĭat(paste0(toupper(type), " file written: "))Ĭat(paste0("File unable to be written.\n"))ġ9 File: visualization.R, author: BIMIB-DISCo, license: Apache License 2.0 Paste0(supported_types, collapse = ", "), "\n"))Ĭat(paste0("Error writing rds: ", path, "\n", e))Ĭon < - file(path, open = "wb", encoding = "native.enc") Supported_types < - c("graphml", "csv", "rds")Ĭat(paste0("File output not supported. Write_output_file < - function(data, type = "rds", name = "File", 19 File: Utils.R, author: vosonlab, license: GNU General Public License v3.0
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |