Lathouri, Maria
2010-Sep-03 11:02 UTC
[R] change the type of lines and colours in interaction.plot
Dear all, I want to plot 8 chemical variables in the same plot. I have used the interaction.plot command:> interaction.plot(speclong$Date,speclong$time2,speclong$outcome,xaxt="n",type="l",pch=20,xlab="", log="y", ylab="Concentration (ug/L)",trace.label="",col=rainbow(8))However, what it gives me is dotted lines and the colours are very fade. I was wondering if I can change the lines to be solid and as well to specify for each line the colour that I want. Thanks a lot. Maria [[alternative HTML version deleted]]
David Winsemius
2010-Sep-03 12:59 UTC
[R] change the type of lines and colours in interaction.plot
On Sep 3, 2010, at 7:02 AM, Lathouri, Maria wrote:> Dear all, > > I want to plot 8 chemical variables in the same plot. I have used > the interaction.plot command: > >> interaction.plot(speclong$Date,speclong$time2,speclong >> $outcome,xaxt="n",type="l",pch=20,xlab="", log="y", >> ylab="Concentration (ug/L)",trace.label="",col=rainbow(8)) > However, what it gives me is dotted lines and the colours are very > fade. I was wondering if I can change the lines to be solid and as > well to specify for each line the colour that I want.Since you provided no workable example, I am just using the second example in the help page to illustrate specifying col, lwd, and lty: > with(ToothGrowth,interaction.plot(dose, supp, len, fixed=TRUE, col = c("red","blue"), lty=1, leg.bty = "o")) > with(ToothGrowth,interaction.plot(dose, supp, len, fixed=TRUE, col = c("red","blue"), lty=1,lwd=3, leg.bty = "o") ) It appears that lwd is not passed on to the legend call. You should carefully review the help page for further information and details: ?par -- David Winsemius, MD West Hartford, CT