Aan de slagGa gratis aan de slag

Graph Sizing

Let's try resizing our static graph to fit its container.

Deze oefening maakt deel uit van de cursus

Building Dashboards with flexdashboard

Cursus bekijken

Oefeninstructies

  • Resize the Trip Durations graph using the fig.width and fig.height arguments. Use the value 10 for the width and the value 6 for the height.
  • Knit and expand the HTML viewer. Try resizing the window and observe what happens.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

{"my_document.Rmd":"---\ntitle: \"Bike Shares Daily\"\noutput: \n  flexdashboard::flex_dashboard:\n    orientation: columns\n    vertical_layout: fill\n---\n\n```{r setup, include=FALSE}\nlibrary(flexdashboard)\nlibrary(readr)\nlibrary(lubridate)\nlibrary(ggplot2)\nlibrary(tidyverse)\n\ntrips_df <- read_csv('https://assets.datacamp.com/production/course_6355/datasets/sanfran_bikeshare_joined_oneday.csv')\n```\n\n\nOverview\n===================================== \n\nColumn {data-width=650}\n-----------------------------------------------------------------------\n\n### Origins\n\n```{r}\n\n```\n\nColumn {data-width=350}\n-----------------------------------------------------------------------\n\n\n### Trips by Start Time\n\n\n### Trip Durations\n\n\n```{r static_plot}\n\ntrips_df %>%\n  mutate(`Trip Duration (min)` = duration_sec / 60) %>%\n  filter(`Trip Duration (min)` <= 60) %>%\n  ggplot(aes(x = `Trip Duration (min)`)) +\n  theme_bw() +\n  geom_histogram(binwidth = 1) +\n  ylab('# Trips')\n\n```\n\n\n"}
Code bewerken en uitvoeren