Graphing 3 Variable Scatterplot R -
i imported data islander , trying graph 3 variables. i'm thinking of trying graph 2 numeric variables nominal category (gender). plot i'm trying therefore regular scatterplot, color-coded.
i looked @ starter tutorial on r: scatterplots, didn't see mention of 3 variable plotting.
http://www.laptopmag.com/articles/ssd-upgrade-tutorial
can me out? variables hold values pertaining number of balls bounced, minutes of physical activity per week, , gender.
picture of data:
data
since gender binary variable (usually, otherwise ternary), plot 2d scatterplot color encoding gender.
dummy data:
a = data.frame(x=runif(100), y = runif(100)+2, group = round(runif(100))+1 )
now plot y
against x
using a$group
select color:
plot(a$y, a$x, pch = 16, col = c('cornflowerblue', 'springgreen')[a$group])
output:
if have missingness add third group color vector. here bunch of other solutions 2d scatter color
Comments
Post a Comment