[R] Having a plot with points and line with different colors

David Carlson dcarlson at tamu.edu
Wed Mar 5 16:53:02 CET 2014


Alternatively use type="c" instead of "l" which will create line
breaks where the points will go.

plot(1:5,type="c", col="blue")
points(1:5,col="black")

David

-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of Jim Lemon
Sent: Wednesday, March 5, 2014 4:08 AM
To: Baro
Cc: R help
Subject: Re: [R] Having a plot with points and line with
different colors

On 03/05/2014 09:09 PM, Baro wrote:
> thanks Jim,
>
> could you please show me some example?
>

# plot lines, then points
plot(1:5,type="l",col="blue")
points(1:5,col="black")
# plot both, then overplot points
plot(1:5,type="o",col="blue")
points(1:5,col="black")

Jim

______________________________________________
R-help at 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.




More information about the R-help mailing list