Hi, Both options work fine! Thanks! I'll play around with the scripts some more to see which way is the best to visualise the data.
Regards Ellen ---------- Forwarded message ---------- From: ellen pape <ellen.p...@gmail.com> Date: 23 July 2012 14:40 Subject: Re: 3D scatterplot, using size of symbols for the fourth variable To: "Rui Barradas [via R]" <ml-node+s789695n4637424...@n4.nabble.com> Hi, Both options work fine! Thanks! I'll play around with the scripts some more to see which way is the best to visualise the data. Regards Ellen On 23 July 2012 13:19, Rui Barradas [via R] < ml-node+s789695n4637424...@n4.nabble.com> wrote: > Hello, > > Maybe the plot argument 'cex' will do it. > > ?par # in particular the entry for 'cex' > s3d$points(MI, TD, EG_18, pch = 16, col = Dstarscale, cex=2*(Dstar - > min(Dstar) + 0.3)) > > > Multiply 2 into it because the points are very small. > > Hope this helps, > > Rui Barradas > Em 23-07-2012 09:20, elpape escreveu: > > > Dear R fans, > > > > I would like to create a scatterplot showing the relationship between 4 > > continuous variables. I thought of using the package "scatterplot 3d" to > > have a 3-dimensional plot and then using the size of the symbols to > > represent the 4th variable. > > > > Does anybody know how to do this? > > > > I already tried to create this graph using the colour of the symbols, > but I > > was unable to generate a legend. Can anyone perhaps tell me why? > > > > #dataframe > > structure(list(Shannon = c(2.707, 2.525, 2.52, 2.447, 2.655, > > 2.404, 2.63, 3.427, 3.381, 2.968, 3.247, 3.063, 3.284, 3.24, > > 2.948, 3.133, 3.482, 3.467, 3.474, 3.659, 3.294, 3.394, 3.293, > > 3.312, 3.386, 3.755, 3.419, 3.586, 3.539, 3.464, 3.461), H0 = c(19L, > > 14L, 17L, 13L, 17L, 14L, 17L, 46L, 49L, 29L, 45L, 51L, 65L, 65L, > > 43L, 56L, 65L, 58L, 59L, 68L, 43L, 55L, 52L, 51L, 55L, 81L, 74L, > > 86L, 57L, 53L, 58L), H1 = c(14.98425525, 12.49089526, 12.42859666, > > 11.55363377, 14.22498606, 11.06735739, 13.8737699, 30.78415163, > > 29.40015657, 19.45297471, 25.71308484, 21.3916359, 26.68228868, > > 25.53372175, 19.06778001, 22.94270452, 32.52470648, 32.04047669, > > 32.26554685, 38.82250095, 26.95045014, 29.78485372, 26.92351316, > > 27.43995053, 29.54752547, 42.73421981, 30.53886089, 36.08942911, > > 34.4324695, 31.9444993, 31.8488094), H2 = c(11.755, 11.255, 9.507, > > 10.125, 12.042, 8.397, 11.791, 23.171, 20.917, 13.902, 15.813, > > 13.739, 15.654, 14.692, 12.078, 13.546, 21.211, 20.437, 22.152, > > 26.635, 18.077, 19.381, 18.042, 18.856, 19.848, 28.671, 18.047, > > 21.797, 24.508, 22.898, 21.368), Hinf = c(5.128205128, 7.692307692, > > 4.504504505, 5.988023952, 6.802721088, 3.831417625, 6.493506494, > > 9.708737864, 9.615384615, 7.142857143, 5.376344086, 5.988023952, > > 6.25, 6.060606061, 4.975124378, 5.291005291, 10, 6.756756757, > > 9.090909091, 10.1010101, 6.41025641, 7.299270073, 8, 9.174311927, > > 9.345794393, 12.65822785, 7.407407407, 8.130081301, 10.1010101, > > 9.803921569, 9.523809524), J = c(0.92, 0.957, 0.889, 0.954, 0.937, > > 0.911, 0.928, 0.895, 0.869, 0.881, 0.853, 0.779, 0.787, 0.776, > > 0.784, 0.778, 0.834, 0.854, 0.852, 0.867, 0.876, 0.847, 0.833, > > 0.842, 0.845, 0.855, 0.794, 0.805, 0.875, 0.872, 0.852), EG_18 = > > c(11.89625579, > > 12.12535291, 10.52322645, 13, 11.94721408, 11.74138905, 11.41864537, > > 13.51174611, 13.08380677, 11.98338672, 12.50012399, 11.33153181, > > 12.05860699, 11.79889475, 10.978733, 11.56314923, 13.04645068, > > 13.19345708, 13.24637756, 13.8929676, 12.76104192, 12.92668353, > > 12.46911655, 12.62784458, 12.87743784, 14.10318753, 12.5553675, > > 13.19308414, 13.6559399, 13.38873489, 13.18810233), TD = c(3.584221748, > > 3.327044025, 3.260869565, 3.52173913, 3.635220126, 2.890710383, > > 3.136082474, 3.433096849, 3.49944009, 3.482109228, 3.561288523, > > 2.994932583, 3.36222162, 3.252259735, 2.986886848, 3.037585943, > > 3.181734279, 3.012922623, 3.194701667, 3.280983686, 3.114578401, > > 3.092463169, 3.352683024, 3.283793025, 3.358701828, 3.445251948, > > 2.873097033, 3.03782087, 3.706619585, 3.325312529, 3.34325186 > > ), MI = c(2.780487805, 2.52173913, 2.622222222, 2.833333333, > > 2.911764706, 2.434782609, 2.435897436, 2.75, 2.748, 2.720930233, > > 2.818584071, 2.377319588, 2.502692998, 2.565891473, 2.391644909, > > 2.418439716, 2.663179916, 2.630177515, 2.550724638, 2.696103896, > > 2.75464684, 2.703583062, 2.825072886, 2.721088435, 2.782334385, > > 2.777777778, 2.618834081, 2.67, 2.743589744, 2.766917293, 2.678321678 > > ), D = c(71.81184669, 58.1027668, 70.89466089, 71.0550887, 65.69900688, > > 70.1863354, 61.76980914, 69.90865312, 67.91876076, 69.8495212, > > 70.04579295, 64.99869296, 67.95894908, 68.35197804, 64.01693209, > > 64.74605873, 69.7579387, 68.87333164, 67.97582936, 71.24014378, > > 71.19738387, 71.54931462, 71.16698452, 70.27831123, 69.36640407, > > 70.84656085, 66.61085878, 68.05601309, 70.77177025, 71.58583791, > > 70.39500159), Dstar = c(76.57440089, 60.99585062, 77.46767581, > > 74.46183953, 69.54177898, 76.21091355, 65.7635468, 72.70359475, > > 71.04353504, 74.38811189, 74.44360179, 70.00021147, 72.46614626, > > 73.26103888, 69.67652555, 69.76706304, 73.05627881, 72.20245655, > > 70.9831013, 73.8268811, 75.1172186, 75.19617965, 75.12340981, > > 73.96171487, 72.81633337, 73.22565624, 70.36018789, 71.22055825, > > 73.51203798, 74.57343, 73.61652018), Dplus = c(79.03091061, 63.89324961, > > 75.94537815, 74.35897436, 70.27310924, 76.13814757, 72.89915966, > > 72.10489993, 71.81729835, 72.06192822, 73.14574315, 73.91253644, > > 74.60851648, 73.50481859, 75.84204413, 73.58345358, 74.11401099, > > 73.79656037, 73.38231611, 73.45415778, 75.39406006, 75.74795575, > > 72.89377289, 74.42016807, 74.15103415, 73.55820106, 71.94689797, > > 73.71748699, 72.52953813, 74.98444951, 74.6151092), Lplus = > c(435.1033529, > > 252.705357, 668.3739672, 828.6707188, 504.3671881, 493.6306125, > > 577.0690629, 458.7755483, 507.6234298, 470.0924753, 481.281377, > > 455.4709007, 533.7458772, 520.7742317, 504.3544853, 482.9535419, > > 514.2758555, 503.053443, 513.1260705, 536.5610267, 523.9890434, > > 508.1071602, 489.4344326, 529.9859238, 505.6095669, 510.3928711, > > 482.2434835, 517.598572, 464.1093393, 525.4025899, 503.6304382 > > ), size_div = c(2.096, 1.738, 2.109, 2.312, 2.133, 2.547, 1.687, > > 2.027, 2.189, 1.894, 2.174, 2.218, 2.19, 2.129, 2.118, 2.154, > > 2.156, 2.311, 2.161, 2.364, 2.236, 2.302, 1.994, 1.99, 2.21, > > 2.187, 2.005, 2.097, 2.105, 2.29, 2.283)), .Names = c("Shannon", > > "H0", "H1", "H2", "Hinf", "J", "EG_18", "TD", "MI", "D", "Dstar", > > "Dplus", "Lplus", "size_div"), class = "data.frame", row.names = c(NA, > > -31L)) > > #This is the code I used for displaying the 4th variable as a colour; I > just > > followed an example from the package manual > > library(scatterplot3d) > > Dstarscale <- hsv((Dstar <- 0.7 * Dstar/ diff(range(Dstar))) - > min(Dstar) + > > 0.3) > > Dstarscale > > > > s3d <- scatterplot3d(MI, TD, EG_18, type = "h", pch = " ") > > s3d$points(MI, TD, EG_18, pch = 16, col = Dstarscale) > > s3d.coords <- s3d$xyz.convert(MI, TD, EG_18) > > plot(seq(min(Dstarscale), max(Dstarscale), length = 100), rep(0, 100), > pch = > > 15, > > axes = FALSE, xlab = "color code of variable \"Dstar\"", > > ylab = "", col = hsv(seq(0.3, 1, length = 100)) > > > > > > Thanks for the help! > > Ellen > > > > > > > > -- > > View this message in context: > http://r.789695.n4.nabble.com/3D-scatterplot-using-size-of-symbols-for-the-fourth-variable-tp4637409.html > > Sent from the R help mailing list archive at Nabble.com. > > > > ______________________________________________ > > [hidden email] > > <http://user/SendEmail.jtp?type=node&node=4637424&i=0>mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ > [hidden email] <http://user/SendEmail.jtp?type=node&node=4637424&i=1>mailing > list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://r.789695.n4.nabble.com/3D-scatterplot-using-size-of-symbols-for-the-fourth-variable-tp4637409p4637424.html > To unsubscribe from 3D scatterplot, using size of symbols for the fourth > variable, click > here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4637409&code=ZWxsZW4ucGFwZUBnbWFpbC5jb218NDYzNzQwOXwyNjY4NjY4NTM=> > . > NAML<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.