Description Usage Arguments Details Value Examples
the function can graphically devide the chart into two periods e.g. past and future.
1 2 3 4 |
data |
datafram |
col_revenue |
character vector denoting revenue column |
col_cost |
character vector denoting cost column |
col_time |
character vector denoting time column |
now |
integer denoting a time which should be regarded as the breakpoint, Default: max(data[, col_time]) |
unit_time |
character vector, will label y-axis, Default: 'years' |
unit_value |
character vector, will label x-axis, Default: 'CHF' |
title |
character vector, will be title label, Default: ” |
alpha_past |
double between 0 and 1 will determine alpha value for fill under the curve before the breakpoint, Default: 1 |
alpha_future |
double between 0 and 1 will determine alpha value for fill under the curve after the breakpoint, Default: 0.5 |
alpha_past_area |
as alpha_past but for area only, Default: 0.9 |
alpha_future_area |
as alpha_future but for area only, Default: 0.7#' |
to some extent plotly compatible
plot (to some extent plotly compatible)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | data = tibble( time = c(0,1,2,3,4,5,6,7,8,9,10,11,12)
, revenue = - time^2 + time * 12
, cost = revenue * 0.4 * -1
)
data[1,'cost'] = -10
data
print( f_plot_profit_bars_plus_area( data, 'revenue', 'cost', 'time') )
print( f_plot_profit_bars_plus_area( data, 'revenue', 'cost', 'time', now = 5) )
#clv figure for presenation
p = f_plot_profit_bars_plus_area( data, 'revenue', 'cost', 'time', now = 5, alpha_past_area = 0) +
theme( panel.grid.major = element_blank()
, panel.grid.minor = element_blank()
, axis.text = element_blank()
)+
labs(x = '', y = '')
print(p)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.