Quantcast
Channel: Active questions tagged lm - Stack Overflow
Viewing all articles
Browse latest Browse all 124

geom_smooth (method = "lm", se = False) - I run this and it changes my Y values

$
0
0

I'm having issues when I run geom_smooth. When I run my script without it my y limits are correct, however when I add geom_smooth my y values are incorrect. When I try to set a limit an error pops up telling me I'm loosing 41 rows of data.

#R script without geom_smooth:

#Plotting Chlorophyll by depth with linear regression line

depth.vs.chloro<- ggplot(data = Spring, mapping = aes(x=Chlorophyll.RFU, y=Depth.Fixed))+geom_point()+scale_y_reverse()+labs(x="Chlorophyll (RFU)", y="Depth (m)")ggsave("depth.vs.chloro.png", width=7, height=5)depth.vs.chloro

#R script with geom_smooth:

depth.vs.chloro<- ggplot(data = Spring, mapping = aes(x=Chlorophyll.RFU, y=Depth.Fixed))+geom_point()+geom_smooth(method = 'lm', se =FALSE)+scale_y_reverse()+labs(x="Chlorophyll (RFU)", y="Depth (m)")ggsave("depth.vs.chloro.png", width=7, height=5)depth.vs.chloro

When I run the last script my Y max value goes from 7, which is correct, to 10 which is not a value in my Depth.Fixed column of my data.

I have tried setting the ylim (0, 7) but this tells me I'm loosing 41 rows of data


Viewing all articles
Browse latest Browse all 124

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>