Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
David Hodge committed Jun 4, 2021
1 parent 49079ea commit baf0fb1
Show file tree
Hide file tree
Showing 15 changed files with 157 additions and 194 deletions.
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-5-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-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 30 additions & 23 deletions docs/articles/ggplotly.html

Large diffs are not rendered by default.

71 changes: 35 additions & 36 deletions docs/articles/leaflet.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/articles/scales.html

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

63 changes: 17 additions & 46 deletions docs/articles/shiny.html

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

Binary file modified docs/articles/shiny_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.
Binary file modified docs/articles/shiny_files/figure-html/unnamed-chunk-4-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions docs/articles/simplevis.html

Large diffs are not rendered by default.

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-06-04T09:37Z
last_built: 2021-06-04T10:23Z

17 changes: 13 additions & 4 deletions vignettes/ggplotly.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ plot <- gg_point_col(penguins, bill_length_mm, body_mass_g, species,
plotly::ggplotly(plot)
```

### Turning off widgets other than the camera

The `plotly_camera` function turns off all widgets other than the camera to make a cleaner graph.

```{r}
plot <- gg_point_col(penguins, bill_length_mm, body_mass_g, species,
font_family = "Helvetica")
plotly::ggplotly(plot) %>%
plotly_camera()
```

### Creating nice tooltips

Use `mutate_text`, `text_var` and `plotly::ggplotly(tooltip = "text")` to make pretty tooltips.
Expand Down Expand Up @@ -78,10 +91,6 @@ plotly::ggplotly(plot, tooltip = "text") %>%
plotly_camera()
```

### Turning off widgets other than the camera

The `plotly_camera` function turns off all widgets other than the camera to make a cleaner graph.

### Controlling the colour legend.

Sometimes the ggplotly legend displays elements in a different order to how you want them. You can reverse them or specify a specific order using `plotly_col_legend`. Note, this only affects the legend elements.
Expand Down
46 changes: 23 additions & 23 deletions vignettes/leaflet.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ knitr::opts_chunk$set(
comment = "#>",
message = FALSE,
warning = FALSE,
fig.height = 3.5,
fig.height = 4.5,
fig.width = 6
)
```

```{r, message = FALSE, warning = FALSE}
library(tidyverse)
```{r}
library(simplevis)
```

Expand All @@ -33,7 +32,7 @@ As per the ggplot sf functions:

There is no facetting functionality provided for leaflet.

```{r, message = FALSE, warning = FALSE, fig.height = 4, fig.width = 7}
```{r}
leaflet_sf_col(data = example_sf_point,
col_var = median,
col_method = "quantile",
Expand All @@ -42,7 +41,7 @@ leaflet_sf_col(data = example_sf_point,
```


```{r, message = FALSE, warning = FALSE, fig.height = 4, fig.width = 7}
```{r}
leaflet_sf_col(example_sf_polygon, density,
col_method = "bin",
col_cuts = c(0, 10, 50, 100, 150, 200, Inf),
Expand All @@ -52,58 +51,59 @@ leaflet_sf_col(example_sf_polygon, density,

The popup will default to a `leafpop::popupTable` of all variables, but can be adjusted to a subset using the `popup_vars_vctr` argument.

```{r, message = FALSE, warning = FALSE, fig.height = 4, fig.width = 7}
```{r}
leaflet_sf_col(example_sf_point, trend_category, popup_vars_vctr = c("site_id", "median"))
```

The tooltip will default to the colour variable, but can be adjusted using the `text_var` variable.

```{r, message = FALSE, warning = FALSE, fig.height = 4, fig.width = 7}
```{r}
leaflet_sf_col(example_sf_point, trend_category, text_var = site_id)
```

### Basemaps

Users have a `basemap` argument that defaults to "light" but has other options.

```{r, message = FALSE, warning = FALSE, fig.height = 4, fig.width = 7}
```{r}
leaflet_sf(example_sf_point, basemap = "dark")
```

```{r, message = FALSE, warning = FALSE, fig.height = 4, fig.width = 7}
```{r}
leaflet_sf(example_sf_point, basemap = "satellite")
```

```{r, message = FALSE, warning = FALSE, fig.height = 4, fig.width = 7}
```{r}
leaflet_sf(example_sf_point, basemap = "street")
```

### Adding additional layers

As a leaflet object is produced, you can add additional layers with leaflet.

```{r}
leaflet_sf_col(example_sf_point,
col_var = trend_category,
pal = c("#0D94A3", "#C4C4C7", "#AE4E51")) %>%
leaflet::addPolygons(data = nz, color = "#35B779", weight = 3, fillOpacity = 0, opacity = 1)
```

### shiny

A leaflet basemap is available for use in shiny apps. It defaults to the top layer being "light".

```{r, message = FALSE, warning = FALSE, fig.height = 4, fig.width = 7}
```{r}
simplevis::leaflet_basemap()
```

You can set the bounds by adding a vector or bbox of bounds.

```{r, message = FALSE, warning = FALSE, fig.height = 4, fig.width = 7}
```{r}
leaflet_basemap(bounds = c(166.70047,-34.45676, 178.52966,-47.06345))
bb <- rnaturalearth::ne_countries(scale = "small", country = "Indonesia", returnclass = "sf") %>%
sf::st_bbox()
simplevis::leaflet_basemap(bounds = bb)
leaflet_basemap(bounds = bb)
```

### Adding additional layers

As a leaflet object is produced, you can add additional layers with leaflet.

```{r, message = FALSE, warning = FALSE, fig.height = 4, fig.width = 7}
leaflet_sf_col(example_sf_point,
col_var = trend_category,
pal = c("#0D94A3", "#C4C4C7", "#AE4E51")) %>%
leaflet::addPolygons(data = nz, color = "#35B779", weight = 3, fillOpacity = 0, opacity = 1)
```
Loading

0 comments on commit baf0fb1

Please sign in to comment.