Closed bergmul closed 4 years ago
No idea what could be 🤔️. Could you give me a minimal reproducible example so I can investigate the error? It probably is data-dependent.
Hi, @bergmul , are you still having this issue? Can you provide a reproducible example so I can find and fix the bug? Thanks!
Hi, here's an MRE based on an example of this bug I am encountering. On
library(metR)
plot_data = data.frame(rbind(
c(0.803938, 0.0000, 0.00000000),
c(4.627267, 0.0025, 0.54040403),
c(4.627267, 0.0100, 0.56553910),
c(4.627267, 1.0000, 2.80256044),
c(4.627267, 0.0400, 0.90486256),
c(4.627267, 0.0900, 1.40756399),
c(4.627267, 0.1600, 1.45783413),
c(4.627267, 0.2500, 1.86627904),
c(4.627267, 0.5625, 2.46952075),
c(5.530359, 0.0025, 0.27020202),
c(5.530359, 0.0100, 0.43357998),
c(5.530359, 1.0000, 3.12931636),
c(5.530359, 0.0400, 0.96770024),
c(5.530359, 0.0900, 1.43898283),
c(5.530359, 0.1600, 1.94168425),
c(5.530359, 0.2500, 2.52607466),
c(5.530359, 0.5625, 3.05391115),
c(6.219067, 0.0025, 0.14452666),
c(6.219067, 0.0100, 0.47756635),
c(6.219067, 1.0000, 3.14188390),
c(6.219067, 0.0400, 1.19391588),
c(6.219067, 0.0900, 1.94796802),
c(6.219067, 0.1600, 2.53864219),
c(6.219067, 0.2500, 2.93451956),
c(6.219067, 0.5625, 3.12303260),
c(9.210564, 0.0025, 0.03141884),
c(9.210564, 0.0100, 1.11536878),
c(9.210564, 1.0000, 3.14188390),
c(9.210564, 0.0400, 3.12931636),
c(9.210564, 0.0900, 3.14188390),
c(9.210564, 0.1600, 3.14188390),
c(9.210564, 0.2500, 3.14188390),
c(9.210564, 0.5625, 3.14188390),
c(6.909987, 0.0025, 0.12567536),
c(6.909987, 0.0100, 0.46499882),
c(6.909987, 1.0000, 3.14188390),
c(6.909987, 0.0400, 1.58350949),
c(6.909987, 0.0900, 2.60147987),
c(6.909987, 0.1600, 3.01620854),
c(6.909987, 0.2500, 3.12931636),
c(6.909987, 0.5625, 3.14188390),
c(7.824939, 0.0025, 0.06912145),
c(7.824939, 0.0100, 0.61580924),
c(7.824939, 1.0000, 3.14188390),
c(7.824939, 0.0400, 2.40668307),
c(7.824939, 0.0900, 3.07904622),
c(7.824939, 0.1600, 3.14188390),
c(7.824939, 0.2500, 3.14188390),
c(7.824939, 0.5625, 3.14188390),
c(8.517640, 0.0025, 0.08112113),
c(8.517640, 0.0100, 0.79489663),
c(8.517640, 1.0000, 3.14188390),
c(8.517640, 0.0400, 2.94708710),
c(8.517640, 0.0900, 3.14188390),
c(8.517640, 0.1600, 3.14188390),
c(8.517640, 0.2500, 3.14188390),
c(8.517640, 0.5625, 3.14188390)
))
colnames(plot_data) = c('x','y','z')
ggplot(plot_data, aes(x,y,z=z)) +
geom_contour_fill(na.fill=TRUE)
Thank you very much. I see that you are using a particularly strange grid.
This now works on the development version on github (remotes::install_github("eliocamp/metR")
)
Let me know if it works for you.
library(metR)
library(ggplot2)
plot_data = data.frame(rbind(
c(0.803938, 0.0000, 0.00000000),
c(4.627267, 0.0025, 0.54040403),
c(4.627267, 0.0100, 0.56553910),
c(4.627267, 1.0000, 2.80256044),
c(4.627267, 0.0400, 0.90486256),
c(4.627267, 0.0900, 1.40756399),
c(4.627267, 0.1600, 1.45783413),
c(4.627267, 0.2500, 1.86627904),
c(4.627267, 0.5625, 2.46952075),
c(5.530359, 0.0025, 0.27020202),
c(5.530359, 0.0100, 0.43357998),
c(5.530359, 1.0000, 3.12931636),
c(5.530359, 0.0400, 0.96770024),
c(5.530359, 0.0900, 1.43898283),
c(5.530359, 0.1600, 1.94168425),
c(5.530359, 0.2500, 2.52607466),
c(5.530359, 0.5625, 3.05391115),
c(6.219067, 0.0025, 0.14452666),
c(6.219067, 0.0100, 0.47756635),
c(6.219067, 1.0000, 3.14188390),
c(6.219067, 0.0400, 1.19391588),
c(6.219067, 0.0900, 1.94796802),
c(6.219067, 0.1600, 2.53864219),
c(6.219067, 0.2500, 2.93451956),
c(6.219067, 0.5625, 3.12303260),
c(9.210564, 0.0025, 0.03141884),
c(9.210564, 0.0100, 1.11536878),
c(9.210564, 1.0000, 3.14188390),
c(9.210564, 0.0400, 3.12931636),
c(9.210564, 0.0900, 3.14188390),
c(9.210564, 0.1600, 3.14188390),
c(9.210564, 0.2500, 3.14188390),
c(9.210564, 0.5625, 3.14188390),
c(6.909987, 0.0025, 0.12567536),
c(6.909987, 0.0100, 0.46499882),
c(6.909987, 1.0000, 3.14188390),
c(6.909987, 0.0400, 1.58350949),
c(6.909987, 0.0900, 2.60147987),
c(6.909987, 0.1600, 3.01620854),
c(6.909987, 0.2500, 3.12931636),
c(6.909987, 0.5625, 3.14188390),
c(7.824939, 0.0025, 0.06912145),
c(7.824939, 0.0100, 0.61580924),
c(7.824939, 1.0000, 3.14188390),
c(7.824939, 0.0400, 2.40668307),
c(7.824939, 0.0900, 3.07904622),
c(7.824939, 0.1600, 3.14188390),
c(7.824939, 0.2500, 3.14188390),
c(7.824939, 0.5625, 3.14188390),
c(8.517640, 0.0025, 0.08112113),
c(8.517640, 0.0100, 0.79489663),
c(8.517640, 1.0000, 3.14188390),
c(8.517640, 0.0400, 2.94708710),
c(8.517640, 0.0900, 3.14188390),
c(8.517640, 0.1600, 3.14188390),
c(8.517640, 0.2500, 3.14188390),
c(8.517640, 0.5625, 3.14188390)
))
colnames(plot_data) = c('x','y','z')
ggplot(plot_data, aes(x,y,z=z)) +
geom_contour_fill(na.fill = TRUE) +
geom_point()
#> Warning: imputing missing values
Created on 2019-10-04 by the reprex package (v0.3.0)
Hi,
after using
na.fill
, I have encountered an error and the package proposes to usena.fill
.Code:
Resulting Error:
Data:
The data consists of roughly 50 points in a 2 dimensional grid with the z-value being a probability.
Issue:
I stumbled on your package for contour line level labels and tried the contour_fill function to replace my current workflow of first running a LOESS regression on the data to use with geom_raster + geom_contour.
The error is a bit comical and I don't see what's going wrong. Potentially
na.fill
needs more data to properly extrapolate to the full space resulting in missing values being picked up even after usingna.fill
? However, if it's user error or a problem with the data, it would be good if the package gives a better error message.