How to plot points over a given plot in R?

r
plotting

#1

I have data set in which I am trying to plot a location using latitude and longitude which is given in the data set. But when I am, trying to plot points with a particular condition I am not able to see my previous plot.

boston = read.csv("boston.csv")
str(boston)
plot(boston$LON, boston$LAT)
plot(boston$LON[boston$CHAS==1], boston$LAT[boston$CHAS==1], col="blue", pch=19)

I want to know how I can plot the points over a given plot.


#2

@sid100158 - You can plot point on the same plot by changing the plot to point in the fourth line of your code.

Hope this helps!

Regards,
Hinduja


#3

Plot command is used to plot a new graph where as if use point instead of plot you can plot the points on the previous plot. So change the plot to point in 4 line.