sorry, the attachment can be found here for download: http://www.wzw.tum.de/waldinventur/fileadmin/coefficient2.RData
katharina wrote: > > Hi there, > > I trying to solve this problem for the whole day not going anywhere, > so I really hope maybe somebody can help > me in this community... > I've got an object coefficient2 which I want to plot in differerent > ways, with colors and labels added to the points, > but somehow there seems to be a problem if a value is NA within the > independent variable, resulting in false labels and false colors for > the points. > > plot(coefficient2$intercept ~ coefficient2$average_height, > main="intercepts ::: height", ylab="intercepts", xlab="average height > per site [cm]", xlim=c(20,3020), ylim=c(-2,5), col=coefficient2$color) > highlight(coefficient2$intercept ~ coefficient2$average_height, > lbls=coefficient2$site_no,col="Red", cex = .6) > > plot(coefficient2$intercept ~ coefficient2$average_dbh, > main="intercepts ::: dbh", ylab="intercepts", xlab="average dbh per > site [mm]", xlim=c(-10,360), ylim=c(-2,5),col=coefficient2$color ) > highlight(coefficient2$intercept ~ coefficient2$average_dbh, > lbls=coefficient2$site_no,col="Red", cex = .6 > > > If I create a temporary object for each plot excluding any NA values > for the x axis variable, somehow all points are displayed and the > labels are correct except for the color (I have e.g. no clue why some > points are red which I do not define at all and no ones are yellow > which I use several times). > > #create temp container for all coefficients with average heights for > plotting > coef_avheight <- coefficient2[which(!is.na(coefficient2$average_height)),] > plot(coef_avheight$intercept ~ coef_avheight$average_height, > main="intercepts ::: height", ylab="intercepts", xlab="average height > per site [cm]", xlim=c(20,3020), ylim=c(-2,5), > col=coef_avheight$color) > highlight(coef_avheight$intercept ~ coef_avheight$average_height, > lbls=coef_avheight$site_no,col="Red", cex = .6) > > #create temp container for all coefficients with average dbh for plotting > coef_avdbh<- coefficient2[which(!is.na(coefficient2$average_dbh)),] > plot(coef_avdbh$intercept ~ coef_avdbh$average_dbh, main="intercepts > ::: dbh", ylab="intercepts", xlab="average dbh per site [mm]", > xlim=c(-10,360), ylim=c(-2,5),col=coef_avdbh$color ) > highlight(coef_avdbh$intercept ~ coef_avdbh$average_dbh, > lbls=coef_avdbh$site_no,col="Red", cex = .6) > > > Maybe someone can explain me the color issue and the problem with the > NA values which results in a wrong labeling and to few > points being displayed? I'm new to R as you can guess and my code > isn't really elegant but I really cannot get faults within it... > > > Attached you can find the referred R object (coefficient2). > highlight requires library(NCStats)... > > Thank you very, very much, > > Katharina > > ______________________________________________ > 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. > > -- View this message in context: http://www.nabble.com/wrong-labels-and-colors-of-points-in-graph-plot-tp23873337p23873849.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.