Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
David Hodge committed May 7, 2021
1 parent 5d0cef5 commit cee7759
Show file tree
Hide file tree
Showing 15 changed files with 136 additions and 124 deletions.
6 changes: 1 addition & 5 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ export(x_numeric_breaks)
export(y_numeric_breaks)
import(ggplot2)
import(leaflet)
import(sf)
importFrom(magrittr,"%>%")
importFrom(rlang,"!!")
importFrom(rlang,.data)
importFrom(sf,st_crs)
importFrom(sf,st_drop_geometry)
importFrom(sf,st_geometry_type)
importFrom(sf,st_is_longlat)
importFrom(sf,st_transform)
2 changes: 1 addition & 1 deletion R/ggplotly.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ plotly_camera <- function(plotly, logo = FALSE){
#' plotly_col_legend(rev = TRUE)
#'
#' plotly::ggplotly(plot) %>%
#' plotly_col_legend(order = c(2, 1, 3:8))
#' plotly_col_legend(order = c(2, 1, 3:7))
plotly_col_legend <- function(plotly, rev = FALSE, order = NULL) {
if(rev == TRUE & !is.null(order)) stop("Please either reverse or provide a specified order, but not both")

Expand Down
6 changes: 1 addition & 5 deletions R/imports.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
#'
#' @import ggplot2
#' @import leaflet
#' @import sf
#' @importFrom rlang !!
#' @importFrom rlang .data
#' @importFrom sf st_crs
#' @importFrom sf st_drop_geometry
#' @importFrom sf st_geometry_type
#' @importFrom sf st_is_longlat
#' @importFrom sf st_transform

NULL

Expand Down
19 changes: 14 additions & 5 deletions R/other.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@
#' plotly::ggplotly(plot, tooltip = "text")
mutate_text <- function(data, text_vars_vctr = NULL, comma = FALSE) {

data <- data %>% dplyr::ungroup()
data <- data %>%
dplyr::ungroup()

class <- class(data)[1]

if(is.null(text_vars_vctr)) {
if(class == "sf") text_vars_vctr <- colnames(data)[colnames(data) != "geometry"]
else if(class != "sf") text_vars_vctr <- colnames(data)
if(class == "sf") {
text_vars_vctr <- colnames(data)[colnames(data) != "geometry"]
} else if(class != "sf") {
text_vars_vctr <- colnames(data)
}
}

text <- vector("character", 0)
Expand All @@ -37,7 +41,7 @@ mutate_text <- function(data, text_vars_vctr = NULL, comma = FALSE) {
temp <- data %>%
dplyr::select(text_vars_vctr[i])

if(class == "sf") temp <- temp %>%
if(class == "sf") temp <- temp %>%
sf::st_drop_geometry()

temp <- paste0(
Expand All @@ -54,7 +58,7 @@ mutate_text <- function(data, text_vars_vctr = NULL, comma = FALSE) {
temp <- data %>%
dplyr::select(text_vars_vctr[i])

if(class == "sf") temp <- temp %>%
if(class == "sf") temp <- temp %>%
sf::st_drop_geometry()

temp <- paste0(
Expand All @@ -68,6 +72,11 @@ mutate_text <- function(data, text_vars_vctr = NULL, comma = FALSE) {

data <- data %>%
dplyr::mutate(text = stringr::str_replace_all(text, " NA<br>", " Not available<br>"))

if(class == "sf") {
data <- data %>%
dplyr::relocate(text, .before = "geometry")
}

return(data)
}
Expand Down
20 changes: 10 additions & 10 deletions docs/articles/colour.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified docs/articles/colour_files/figure-html/unnamed-chunk-6-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/articles/colour_files/figure-html/unnamed-chunk-6-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
129 changes: 70 additions & 59 deletions docs/articles/ggplotly.html

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions docs/articles/leaflet.html

Large diffs are not rendered by default.

Binary file modified docs/articles/shiny_files/figure-html/unnamed-chunk-2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 14 additions & 14 deletions docs/articles/simplevis.html

Large diffs are not rendered by default.

Binary file modified docs/articles/simplevis_files/figure-html/unnamed-chunk-3-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ articles:
scales: scales.html
shiny: shiny.html
simplevis: simplevis.html
last_built: 2021-05-07T04:14Z
last_built: 2021-05-07T06:03Z

2 changes: 1 addition & 1 deletion docs/reference/plotly_col_legend.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plotly_col_legend.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cee7759

Please sign in to comment.