prediction from a rank-deficient fit may be misleading in geom_smooth()
You're encountering a numerical precision rounding problem.
You could center x
by substracting mean(x)
.
ggplot(temp, aes(x, y)) +
geom_point() +
geom_smooth(method= "lm", formula = y ~ I(x-mean(x)))
error when adding lm to datetime data in ggplot2
Typically the package picks the orientation (x or y) automatically. However, when it becomes uncertain, you see that message. You don't need to specify the formula, you can just specify the orientation.
library("ggplot2")
library("scales")
ggplot(aes(x = Time, y = LIN), data = ToPlot) +
geom_point() +
geom_line() +
scale_x_datetime(labels = date_format("%H:%m:%S"))+
geom_smooth(method='lm', orientation = "y")
Related Topics
How to Maintain Size of Ggplot with Long Labels
How to Pass Dynamic Column Names in Dplyr into Custom Function
Install.Packages Fails in Knitr Document: "Trying to Use Cran Without Setting a Mirror"
Different Breaks Per Facet in Ggplot2 Histogram
R: What Do You Call the :: and ::: Operators and How Do They Differ
Adding Regression Line Per Group with Ggplot2
Tidyr How to Spread into Count of Occurrence
Apply a Function to a Subset of Data.Table Columns, by Column-Indices Instead of Name
Data.Table Join Then Add Columns to Existing Data.Frame Without Re-Copy
R Scatter Plot: Symbol Color Represents Number of Overlapping Points
R Ggplot2: Labelling a Horizontal Line on the Y Axis with a Numeric Value
R: How to Run Some Code on Load of Package
How to Align the Bars of a Histogram with the X Axis
R- How to Dynamically Name Data Frames
Add Text to Horizontal Barplot in R, Y-Axis at Different Scale