podlove_graph_download_curves: Create download curve plot

Description Usage Arguments Value See Also Examples

View source: R/podlove_graph_download_curves.R

Description

Based on a prepared dataset, this function creates a line curve diagram of downloads over time. It takes an optional grouping variable (e.g. title) as well as options for cumulative display, labeling and print output. For more finetuning options, use the podlove_baseplot() function and add geoms to your liking.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
podlove_graph_download_curves(
  df_tidy_data,
  gvar = "Total",
  cumulative = TRUE,
  plot_type = "line",
  labelmethod = "last.points",
  limit = TRUE,
  legend = FALSE,
  printout = TRUE,
  ...
)

Arguments

df_tidy_data

A tidy data frame with download data, as constructed by podlove_prepare_stats_for_graph()

gvar

Optional grouping parameter (e.g. episode title), handed over to ggplot2::aes(color).

cumulative

Boolean switch to show either cumulative data (TRUE, default), or non-comulative data (FALSE)

plot_type

Sets the plot type to either line plot ("line") or ridgeline plot ("ridge").

labelmethod

Defines where should the labels be attached (at the beinning of the curves: "last.points", default, or at the end of the curves "first.points")

limit

Boolean switch to fix axis limtis (relevant when adding smoothers)

legend

Boolean switch to add a legend'

printout

Switcher to automatically print out the plot (default TRUE)

...

additional formating parameters for ggplot2::geom_line() or ggridges::geom_density_ridges.

Value

A ggplot object

See Also

podlove_prepare_stats_for_graph()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
# relative, daily plot by episode title, cumulative
data("podcast_example_data")
gdata <- podlove_prepare_stats_for_graph(podcast_example_data, gvar = title) 
podlove_graph_download_curves(gdata, gvar = title, cumulative = TRUE)

# relative, hourly plot by episode number, cumulative
gdata <- podlove_prepare_stats_for_graph(podcast_example_data, 
                                         gvar = ep_number, hourly = TRUE) 
podlove_graph_download_curves(gdata, gvar = ep_number, cumulative = TRUE)

# absolute, daily plot by episode title, noncumulative, with labels at the beginning
gdata <- podlove_prepare_stats_for_graph(podcast_example_data, 
                                         gvar = title, relative = FALSE) 
podlove_graph_download_curves(gdata, gvar = title, cumulative = FALSE, 
                              labelmethod = "first.points")
                              
# abolute, hourly plot by podcast client name, cumulative
gdata <- podlove_prepare_stats_for_graph(podcast_example_data, 
                                         gvar = client_name, relative = FALSE) 
podlove_graph_download_curves(gdata, gvar = client_name, cumulative = TRUE)

## End(Not run)

lordyo/podlover documentation built on Feb. 20, 2020, 5:58 p.m.