0

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

YefR
  • 369
  • 3
  • 12
  • 4
    It is not entirely clear what you mean with "broken". Is it the missing interpolation of the pixels? This is an issue of the graphical device. If you save the plot as PDF it should look more smooth. See also https://stackoverflow.com/questions/6023179/anti-aliasing-in-r-graphics-under-windows-as-per-mac – jakob-r Feb 21 '20 at 14:15

1 Answers1

1

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

caldwellst
  • 5,719
  • 6
  • 22