f_plot_profit_bars_plus_area: plot revenues cost and profit development over time with bars...

Description Usage Arguments Details Value Examples

View source: R/f_plot_profit.R

Description

the function can graphically devide the chart into two periods e.g. past and future.

Usage

1
2
3
4
f_plot_profit_bars_plus_area(data, col_revenue, col_cost, col_time,
  now = max(data[, col_time]), unit_time = "years", unit_value = "CHF",
  title = "", alpha_past = 1, alpha_future = 0.5, alpha_past_area = 0.9,
  alpha_future_area = 0.7)

Arguments

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#'

Details

to some extent plotly compatible

Value

plot (to some extent plotly compatible)

Examples

 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)

erblast/oetteR documentation built on June 13, 2018, 9:05 a.m.