usccana / netplot Goto Github PK
View Code? Open in Web Editor NEWBeautiful graph drawing
Home Page: https://usccana.github.io/netplot/
License: Other
Beautiful graph drawing
Home Page: https://usccana.github.io/netplot/
License: Other
library(ergm)
library(netplot)
n <- 50
n_egos <- 10
net <- as.network(matrix(0, ncol = n, nrow = n), directed = TRUE)
nplot(net)
# Error in quantile.default(netenv$vertex.size, 1 - netenv$vertex.label.show[1]) :
# missing values and NaN's not allowed if 'na.rm' is FALSE
Hey @gvegayon! As discussed, here is the error we bumped into.
library(igraph)
#>
#> Attaching package: 'igraph'
#> The following objects are masked from 'package:stats':
#>
#> decompose, spectrum
#> The following object is masked from 'package:base':
#>
#> union
library(netplot)
#> Loading required package: grid
#>
#> Attaching package: 'netplot'
#> The following object is masked from 'package:igraph':
#>
#> ego
set.seed(123)
g <- erdos.renyi.game(50, 0.2)
teams <- c("Utah", "Wyoming", "Idaho", "Nevada")
V(g)$team <- sample(teams, vcount(g), replace=TRUE)
# Map teams to sides
team_sides <- c(Utah=4, Wyoming=6, Idaho=3, Nevada=5)
sides <- team_sides[V(g)$team]
# Map teams to colors
team_colors <- c(Utah="red", Wyoming="darkgreen", Idaho="blue", Nevada="purple")
# Get color for each vertex
vertex_colors <- team_colors[V(g)$team]
# Plot
# Create empty plot
plot(0,type="n", axes=FALSE)
nplot(g,
vertex.color = ~team,
vertex.nsides= ~team)
#> Error in eval(netenv$vertex.nsides, envir = data): invalid 'envir' argument of type 'closure'
Created on 2023-10-04 with reprex v2.0.2
Using Spring Algorithms to Remove Node Overlapping (https://dl.acm.org/citation.cfm?id=1082334)
https://stackoverflow.com/questions/3265986/an-algorithm-to-space-out-overlapping-rectangles
The way I wrote set_gpar
, it will replicate arguments and turn them into a list. Unfortunately, when passing an argument that IS A LIST, like grid::radialGradient()
, does not work. This should be an easy fix.This is the code that fails:
p <- nplot(...)
p <- set_vertex_gpar(p, "core", fill = radialGradient(c("white", "black"), cx1=.8, cy1=.8, r1=0))
print(p) # fails
Fantastic Package! Vertex labels with new lines are enabled in igraph plotting but not in this package. It would increase my use greatly if I could include new lines in my vertex labels like "Com 12\nMemmory T cells". Maybe a bug, maybe a enhancement... not sure.
Correct the curvature level when more than 1 edge exists. For this I may need to use c++ so I can easily (fast) find multiple ties. The function which_multiple from igraph returns a count, but nothing about which.
Right now we do have a function to parse formulas for edge colors, but ideally, we could have a more comprehensive/flexible system to parse formulas and return various types of outcomes.
Mixing these three should be relatively straightforward. Since at the edge level, we will only find one attribute of each.
The problem is when, for example, we would like to generate a statistic at the ego-network level.
This could follow a goal similar to what the scales
R package does, this is, return palettes/functions for plots.
Hi,
Thank you so much for building an incredible network visualization tool! I'm curious if I am missing something. I have an undirected network that I'd like to visualize without edge arrows. I have set skip.arrows=T, but the network plot still shows edge arrows. Is there a straightforward way to remove the arrows that I am missing?
I am sorry if I am overlooking something obvious.
Thank you so much.
One option for this is to perform some of the calculations using C++. The current version tries to vectorize as much as it can, but when dealing with, for example, 10 line breaks per edge calculations can become cumbersome.
Should be the following:
This will work as a shortcut to vertex.nbreaks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.