Generally, the range of the input value of stacked chart is greater than or equal to zero. This function splits variable into positive and negative parts in order to include negative values to stacked chart.
split_variable_into_positive_and_negative_parts(
df_all,
domain_column_name,
variable_column_name,
value_column_name,
variable_name_converter = function(x) { paste(x, "_negative", sep = "") },
increment_of_domain_in_interpolation = 0.1
)input data frame
domain column name, such as year
variable column name, such as 'coal'
value column name, such as 'val'
function which convert original variable name into its negative part name
step size for interpolation
modified data frame