raw history, relevant calls are with anglr:: and rgl functions (ignore the ggplot that's interleaved I was checking against plots)
library(anglr)
as.contour(large_topo_spat)
as.contour(large_topo_spat, levels = c(-1500, -1100, -700, -300, 0))
plot3d(as.contour(large_topo_spat, levels = c(-1500, -1100, -700, -300, 0)))
plot3d(sf::st_as_sf(as.contour(large_topo_spat, levels = c(-1500, -1100, -700, -300, 0))))
rgl::rglwidget()
plot3d(sf::st_as_sf(as.contour(large_topo_spat, levels = c(-1600, -1200, -800, 4300, 0))))
rgl::rglwidget()
plot3d(sf::st_as_sf(as.contour(large_topo_spat, levels = c(-1600, -1200, -800, -400, 0))))
rgl::axes3d()
rgl::rglwidget()
plot3d(sf::st_as_sf(as.contour(large_topo_spat, levels = seq(-4000, 0, by = 400))))
rgl::rglwidget()
plot3d(sf::st_as_sf(as.contour(large_topo_spat, levels = seq(-4000, 0, by = 400)))); rgl::aspect3d(1/cos(-60 * pi/180), 1, .01)
rgl::rglwidget()
bathycontours <- sf::st_as_sf(as.contour(large_topo_spat, levels = seq(-4000, 0, by = 400)))
bathycontours$color <- "grey"
plot3d(bathycontours)
rgl::rglwidget()
bathycontours$color_ <- "grey"
plot3d(bathycontours)
rgl::rglwidget()
plot(bathycontours)
plot(bathycontours[0])
polygons_sf
plot3d(bathycontours)
polygons_sf$color_ <- hcl.colors(10, alpha = .5)
polygons_sf$color_ <- hcl.colors(16, alpha = .5)
plot3d(polygons_sf, add = T)
rgl::rglwidget()
ggplot() +
geom_spatraster(data = glacier) +
#geom_spatraster_contour(data = fine_topo_spat, binwidth=400)+
geom_spatraster_contour_text(data = fine_topo_spat, binwidth=300)+
xlab("Longitude") + ylab("Latitude")+
scale_fill_cmocean(name = "deep", direction = -1, alpha = 0.5,
#labels = c("continent", "islands", "ice shelf"),
guide = guide_legend(title = "Type"))+
# plot tracks or envelops
geom_point(data = position_seals,
aes(x = lon,
y = lat),
size = 0.055, alpha=1/50) +
geom_point(data = pt4, aes(x = lon, y = lat),
shape = 21, color = "black", fill = "yellow", size = 1) +
scale_x_continuous(breaks = c(140, 141)) +
scale_y_continuous(breaks = c(-66.4, -66.8))+
theme_minimal() +
theme(axis.title.x = element_text(size = 7), # Change x-axis title size
axis.title.y = element_text(size = 7), # Change y-axis title size
axis.text.x = element_text(size = 7), # Change x-axis label size
axis.text.y = element_text(size = 7) ,
strip.text = element_text(size = 7), #face = "bold"
legend.title = element_text(size = 7),
legend.text = element_text(size = 7),
panel.spacing=unit(0, "lines"),
legend.position = "bottom")
ggplot() +
geom_spatraster(data = glacier) +
#geom_spatraster_contour(data = fine_topo_spat, binwidth=400)+
geom_spatraster_contour_text(data = fine_topo_spat, binwidth=300)+
xlab("Longitude") + ylab("Latitude")+
scale_fill_cmocean(name = "deep", direction = -1, alpha = 0.5,
#labels = c("continent", "islands", "ice shelf"),
guide = guide_legend(title = "Type"))+
# plot tracks or envelops
geom_point(data = r_df, aes(x = x, y = y), color = "black", alpha = 0.2) +
new_scale_fill() +
geom_contour_filled(data = r2_rast, aes(x, y, z = value), breaks = quantile(r_df$value, qts), alpha = 1/5)+
geom_point(data = pt4, aes(x = lon, y = lat),
shape = 21, color = "black", fill = "yellow", size = 1) +
scale_x_continuous(breaks = c(140, 141)) +
scale_y_continuous(breaks = c(-66.4, -66.8))+
theme_minimal() +
theme(axis.title.x = element_text(size = 7), # Change x-axis title size
axis.title.y = element_text(size = 7), # Change y-axis title size
axis.text.x = element_text(size = 7), # Change x-axis label size
axis.text.y = element_text(size = 7) ,
strip.text = element_text(size = 7), #face = "bold"
legend.title = element_text(size = 7),
legend.text = element_text(size = 7),
panel.spacing=unit(0, "lines"),
legend.position = "bottom")
r2_rast
## let's make the data a bit less coarse
r2_rast <- crop(rast(r_df), ext(139.5, 141.5, -67, -66.4))
r2_rast[is.na(r2_rast)] <- 0
r2_rast <- disagg(r2_rast, 4, method = "bilinear")
r2_rast_df <- as.data.frame(r2_rast, xy = TRUE)
plot(r2_rast_df)
plot(r2_rast)
as.contours(r2_rast, levels = quantile(r_df$value, qts))
as.contour(r2_rast, levels = quantile(r_df$value, qts))
plot(as.contour(r2_rast, levels = quantile(r_df$value, qts)), add = T)
ts_contours <- as.contour(r2_rast, levels = quantile(r_df$value, qts))
ts_contours$color_ <- hcl.colors(3, alpha = .5)
plot3d(bathycontours); plot3d(ts_contours, add = T); rgl::rglwidget()
plot3d(bathycontours); plot3d(sf::st_as_sf(ts_contours), add = T); rgl::rglwidget()
ggplot() +
geom_spatraster(data = glacier) +
#geom_spatraster_contour(data = fine_topo_spat, binwidth=400)+
geom_spatraster_contour_text(data = fine_topo_spat, binwidth=300)+
xlab("Longitude") + ylab("Latitude")+
scale_fill_cmocean(name = "deep", direction = -1, alpha = 0.5,
#labels = c("continent", "islands", "ice shelf"),
guide = guide_legend(title = "Type"))+
# plot tracks or envelops
geom_point(data = r_df, aes(x = x, y = y), color = "black", alpha = 0.2) +
new_scale_fill() +
geom_contour_filled(data = r2_rast_df, aes(x, y, z = value), breaks = quantile(r_df$value, qts), alpha = 1/5)+
geom_point(data = pt4, aes(x = lon, y = lat),
shape = 21, color = "black", fill = "yellow", size = 1) +
scale_x_continuous(breaks = c(140, 141)) +
scale_y_continuous(breaks = c(-66.4, -66.8))+
theme_minimal() +
theme(axis.title.x = element_text(size = 7), # Change x-axis title size
axis.title.y = element_text(size = 7), # Change y-axis title size
axis.text.x = element_text(size = 7), # Change x-axis label size
axis.text.y = element_text(size = 7) ,
strip.text = element_text(size = 7), #face = "bold"
legend.title = element_text(size = 7),
legend.text = element_text(size = 7),
panel.spacing=unit(0, "lines"),
legend.position = "bottom")
ggplot() +
geom_spatraster(data = glacier) +
#geom_spatraster_contour(data = fine_topo_spat, binwidth=400)+
geom_spatraster_contour_text(data = fine_topo_spat, binwidth=300)+
xlab("Longitude") + ylab("Latitude")+
scale_fill_cmocean(name = "deep", direction = -1, alpha = 0.5,
#labels = c("continent", "islands", "ice shelf"),
guide = guide_legend(title = "Type"))+
# plot tracks or envelops
geom_point(data = position_seals,
aes(x = lon,
y = lat),
size = 0.055, alpha=1/50) +
geom_point(data = pt4, aes(x = lon, y = lat),
shape = 21, color = "black", fill = "yellow", size = 1) +
scale_x_continuous(breaks = c(140, 141)) +
scale_y_continuous(breaks = c(-66.4, -66.8))+
theme_minimal() +
theme(axis.title.x = element_text(size = 7), # Change x-axis title size
axis.title.y = element_text(size = 7), # Change y-axis title size
axis.text.x = element_text(size = 7), # Change x-axis label size
axis.text.y = element_text(size = 7) ,
strip.text = element_text(size = 7), #face = "bold"
legend.title = element_text(size = 7),
legend.text = element_text(size = 7),
panel.spacing=unit(0, "lines"),
legend.position = "bottom")
pt4
abund <- readxl::read_excel("fish_abundance_2006_2007_2009_ROV.xlsx")
head(abund)
library(purrr)
library(tidyr)
tidyr::pivot_longer(abund, -(station, latitude, longitude, temps))
tidyr::pivot_longer(abund, -c(station, latitude, longitude, temps))
tidyr::pivot_longer(abund, -c(station, latitude, longitude, temps)) |> dplyr::filter(value > 0)
xx <- tidyr::pivot_longer(abund, -c(station, latitude, longitude, temps)) |> dplyr::filter(value > 0)
dplyr::distinct(xx, name)
plot3d(bathycontours); plot3d(sf::st_as_sf(ts_contours), add = T);
plot3d(xx$longitude, xx$latitude, xx$value, add = T)
rgl::rglwidget()
plot3d(bathycontours); plot3d(sf::st_as_sf(ts_contours), add = T);
plot3d(xx$longitude, xx$latitude, xx$value, add = T);
rgl::aspect3d(1/cos(-67 * pi/180), 1, .1)
rgl::rglwidget()
plot3d(bathycontours); plot3d(sf::st_as_sf(ts_contours), add = T);
plot3d(xx$longitude, xx$latitude, xx$value, add = T);
rgl::aspect3d(1/cos(-67 * pi/180), 1, .5)
rgl::rglwidget()
plot3d(bathycontours); plot3d(sf::st_as_sf(ts_contours), add = T);
plot3d(xx$longitude, xx$latitude, xx$value, add = T);
rgl::aspect3d(1/cos(-67 * pi/180), 1, 1.5)
rgl::rglwidget()
x_sub2
plot3d(large_topo_spat)
plot3d(raster::raster(large_topo_spat))
plot3d(bathycontours);
plot3d(sf::st_as_sf(ts_contours), add = T);
plot3d(raster::raster(large_topo_spat), add = TRUE)
plot3d(xx$longitude, xx$latitude, xx$value, add = T);
rgl::aspect3d(1/cos(-67 * pi/180), 1, 1.5)
rgl::rglwidget()
plot3d(bathycontours);
plot3d(sf::st_as_sf(ts_contours), add = T);
plot3d(raster::raster(large_topo_spat), add = TRUE, col = "white")
plot3d(xx$longitude, xx$latitude, xx$value, add = T);
rgl::aspect3d(1/cos(-67 * pi/180), 1, 1.5)
rgl::rglwidget()
plot3d(bathycontours);
plot3d(sf::st_as_sf(ts_contours), add = T);
plot3d(raster::raster(large_topo_spat), add = TRUE, color = "white")
plot3d(xx$longitude, xx$latitude, xx$value, add = T);
rgl::aspect3d(1/cos(-67 * pi/180), 1, 1.5)
rgl::rglwidget()
#plot3d(bathycontours);
plot3d(sf::st_as_sf(ts_contours), add = F);
plot3d(raster::raster(large_topo_spat), add = TRUE, color = "white")
plot3d(xx$longitude, xx$latitude, xx$value, add = T, col = "red");
rgl::aspect3d(1/cos(-67 * pi/180), 1, 1.5)
rgl::rglwidget() ## displays in view, which can write to html