0

How can we plot a 3D plot for the in-out degree distribution. I found the the plot here: http://en.wikipedia.org/wiki/Degree_distribution really interesting but I do not know if we can draw it using r ? any ideas ?

update: the data that I am using is the degree distribution of the in-degree and out-degree:

> head(dDistribution_in)
[1] 0.30117450 0.19379195 0.10654362 0.06291946 0.03775168 0.03313758
> head(dDistribution_out)
[1] 0.36115772 0.17072148 0.09228188 0.05369128 0.04572148 0.02055369
M.M
  • 1,343
  • 7
  • 20
  • 49

1 Answers1

0

You can do this with perspective plots, here's an example that should help:

require(MASS)
set.seed(42)
persp(kde2d(rnorm(100), rnorm(100)), col="grey90", shade=1, theta=120, xlab="X")

enter image description here

If you're asking specifically about replicating this degree distribution, you can use the same idea on your data. Also, while 3D styled plots can look good, a clearer representation of that data may be something like a hexagonally-binned 2d histogram.

Update

Using the small sample of your data works fine:

d_in <- c(0.30117450, 0.19379195, 0.10654362, 0.06291946, 0.03775168, 0.03313758)
d_out <- c(0.36115772, 0.17072148, 0.09228188, 0.05369128, 0.04572148, 0.02055369)

persp(kde2d(d_in, d_out), col="grey90", shade=1, theta=120, xlab="X")

enter image description here

Not sure what you're doing wrong, but see this post on how to make a reproducible example.

Community
  • 1
  • 1
blmoore
  • 1,487
  • 16
  • 31
  • Thanks for your reply. Are you sure that this will work for the degree distribution of a network ? I tried it but I got " default method not implemented for type 'list'" – M.M Sep 12 '13 at 11:46
  • I/We have no idea of how your data looks or is stored unless you post a segment of it or a reproducible example... Type `head(yourData)` and `str(yourData)` and add the output to your question. – blmoore Sep 12 '13 at 11:50
  • I've added the a segment of the used data. It is the degree distribution of the in degree and the degree distribution of the out degree – M.M Sep 12 '13 at 12:52
  • Edited with example data – blmoore Sep 12 '13 at 13:50