In R, how can I use different colors for each range in my scatterplot? -


i'm trying plot r series of 120 numbers first 40 of 1 type, next 40 items of second type , last 40 items of third type.

right i'm plotting scatter-plot , hard tell 3 sections apart:

data <- read.table("mydata.txt") plot(data[,1]) 

what have

is there way distinguish 3 sections, in following mockup made?

what want

you provide colour vector if data ordered.

mydata <- runif(120) plot(mydata, col = rep(rainbow(3), each = 40)) 

rainbow(3) makes colour vector of 3 colours, , rep each = 40 makes 40 copies of each.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -