YefR
YefR

Reputation: 369

How to avoid broken line in ggplot2

I try to plot a graph in R using the ggplot2 package. Let's assume I have the following data:

df1<-data.frame(xpos=c(1,2,3,4),ypos=c(0.222,0.222,0.303,0.285))  

Now, I want to plot a simple line graph:

ggplot(data=df1, aes(x=xpos, y=ypos)) +
  geom_line()+
  geom_point()

enter image description here

Now, when I adjust the y-axis:

+scale_y_continuous("Y rates upd", breaks=seq(0,1,0.2),limits=c(0,1))

The lines get "broken" enter image description here

Upvotes: 0

Views: 471

Answers (1)

caldwellst
caldwellst

Reputation: 5956

That's dependent upon your graphics device that plots are sent to from R. See the same plot below when I instead export it to PDF.

enter image description here

Upvotes: 1

Related Questions