R6 class for plotting Turf objects. Can be used directly from
the Turf class by calling the $plot accessor.
Methods
Method incremental_plot()
Plot Incremental Reach
Visualizes how reach improves as more items are added to the TURF combination set. This is useful to assess the diminishing returns of adding more items. The function plots the top combination (by reach, or by reach then frequency if available) at each combination size.
Usage
TurfPlotter$incremental_plot(
metric,
point_size = 25,
text_size = 6,
point_color = "#50bd90",
line_color = "#cccccc",
add_frequency = FALSE
)Arguments
metricA character string indicating which reach metric to plot. Must match one of the metrics computed in the associated
Turfobject.point_sizeA numeric scalar controlling the size of points in the plot. Default is 25.
text_sizeA numeric scalar controlling the font size of percentage labels. Default is 6.
point_colorPlot colour of plot. A valid colour.
line_colorLine colour of plot. A valid colour.
add_frequencyA logical flag indicating whether to show frequency values below each point. Not supported for
weighted_reach. Default isFALSE.
Method topN_plot()
Plot TURF combinations
When a combination has been selected, plot top N combinations by reach.
Usage
TurfPlotter$topN_plot(
metric,
n_item,
top_n = 3,
color_palette = NULL,
wrap_length = 60,
...
)Arguments
metricMetric to plot reach from?
n_itemCombination size to plot
top_nTop N combinations to plot
color_paletteOptional palette (named vector or dataframe)
wrap_lengthLabel wrap length
...Extra arguments to be used in
g6tr.theme::g6tr_bar_plot()