frflib.plots.plotly_

Module Contents

Functions

plot_time_serie(df_dyn, plot_param, title[, group_name])

plot a time serie based on plot_parm dictionary (from catalog)

plot_stacked_series(df_dynamic, df_static, x_axis, ...)

allow to plot a time series stacked (area) based on given category (field or reservoir

plot_scatter(df, x_axis, y_axis, **kwargs)

param df:

plot_regression(df, forecasted, observed, **kwargs)

param df:

filter_main_groups(df_plot, value[, min_value_rel, ...])

function to filter on main groups - mainly for plotting purpse (histogram / pie plor /...)

get_main_groups(df_plot, groupby[, min_value_rel, ...])

function to filter on main groups - mainly for plotting purpse (histogram / pie plor /...)

pie_plot(data, value[, groupby, agg, max_group, ...])

simple function to generate pie plot from a dataframe

bar_plot(df_plot, y, **kwargs)

param df:

timeserie_heatmap(df_dyn, var[, sort_list, ...])

function to plots a set of wells in a heatmap where the y axis is the wellnames and x axis is the date

tornado_char(df, min_val_col, max_val_col[, ...])

Plot to generate a tornado chart based on formatted data frame - the Data expected is on index the variable for

pair_plot(data[, columns, groupby, half_plot, ...])

Pair plot - similar to seaborn with histogram (kernal density) in the diagonal

plot_group_dist(data[, columns, groupby, ...])

Function that allow plotting distribution od static parameters by groups (col = groupby)

frflib.plots.plotly_.plot_time_serie(df_dyn, plot_param, title, group_name='')

plot a time serie based on plot_parm dictionary (from catalog) :param df_dyn: dynamic dataframe :param plot_param: dictionary discribing the plot :param title: 1st part of the title :param group_name: 2nd part of the title :return:

frflib.plots.plotly_.plot_stacked_series(df_dynamic, df_static, x_axis, y_axis, category, color_discrete_map=None)

allow to plot a time series stacked (area) based on given category (field or reservoir :param df_dynamic: dynamic dataframe (wellname and date as index) :param df_static: static dataframe wellname as index :param x_axis: x for the plotgi :param y_axis: y for the plot :param category: category to sum on :param color_discrete_map :return: plotly figure

frflib.plots.plotly_.plot_scatter(df, x_axis, y_axis, **kwargs)
Parameters:
  • df

  • x_axis

  • y_axis

  • kwargs

Returns:

frflib.plots.plotly_.plot_regression(df, forecasted, observed, **kwargs)
Parameters:
  • df

  • forecasted

  • observed

  • kwargs

Returns:

frflib.plots.plotly_.filter_main_groups(df_plot, value, min_value_rel=None, min_value_abs=None, max_group=None)

function to filter on main groups - mainly for plotting purpse (histogram / pie plor /…) It will filter base:

  • absolute min value

  • relative min value

  • select only top groups

the data must be a dataframe with the groups being the index - all the groups that are not selected will be gathered in ‘other

Parameters:
  • df_plot – data frame with groups as index

  • value – column name

  • min_value_rel

  • min_value_abs

  • max_group

Returns:

modified dataframe

frflib.plots.plotly_.get_main_groups(df_plot, groupby, min_value_rel=None, min_value_abs=None, max_group=None)

function to filter on main groups - mainly for plotting purpse (histogram / pie plor /…) It will filter base:

  • absolute min value

  • relative min value

  • select only top groups

the data must be a dataframe with the groups being the index - all the groups that are not selected will be gathered in ‘other

Parameters:
  • df_plot – data frame with groups as index

  • value – column name

  • min_value_rel

  • min_value_abs

  • max_group

Returns:

modified dataframe

frflib.plots.plotly_.pie_plot(data, value, groupby=None, agg=None, max_group=None, min_value_abs=None, min_value_rel=None, ignore_last=0, color_discrete_map=None, **kwargs)

simple function to generate pie plot from a dataframe :param df: dataframe :param labels: the group (category) on which the pie will be computed :param agg: if None - pie values will be on values colums / if sum or count groupby label will be performed :param values: string - value columns :param kwargs: title: textinfo: hole_size: color_list:

Returns:

plotly figure

frflib.plots.plotly_.bar_plot(df_plot, y, **kwargs)
Parameters:
  • df

  • values

  • kwargs

Returns:

frflib.plots.plotly_.timeserie_heatmap(df_dyn, var, sort_list=None, colorscale='Viridis', na_val=0, zmin=None, zmax=None, total=None, idx_name=None)

function to plots a set of wells in a heatmap where the y axis is the wellnames and x axis is the date

Parameters:
  • df_dyn – dataframe dynamic

  • var – variable to be plot

  • sort_list – sorted list to be used - default None: No sorting of the well

  • colorscale – plotly color scales

  • na_val – value to be used for NA. Default 0

  • total – (str) default None - add a secondary graph below the plot: - if total = ‘sum’ - the sum of the time serie will plotted - if total = ‘mean’ - the sum of the time serie will plotted - if total = ‘threshold’ - the count of the values where var > zmax will be plotted

Returns:

plotly figure

frflib.plots.plotly_.tornado_char(df, min_val_col, max_val_col, min_label=None, max_label=None, title=None, width=500, height=500)

Plot to generate a tornado chart based on formatted data frame - the Data expected is on index the variable for sensitivities or cases with min and max values parameters and values

Parameters:
  • df – dataframe dataframe

  • min_val_col – values for min sensitivities

  • max_val_col – values for max sensitivities

  • min_label – min sensitivities val

  • max_label – max sensitivities val

  • title – figure title

  • width – figure width

  • height – figure height

Returns:

plotly figure

frflib.plots.plotly_.pair_plot(data, columns=None, groupby=None, half_plot=True, group_dict_color=None, threshold_groupby=1, max_group=5, title=None)

Pair plot - similar to seaborn with histogram (kernal density) in the diagonal It takes color by group size not yet implemented

Parameters:
  • df – dataframe with the data

  • columns – columns to be selected for the pair plot

  • groupby

  • size

Returns:

frflib.plots.plotly_.plot_group_dist(data, columns=None, groupby=None, group_dict_color=None, title=None, col_num=3)

Function that allow plotting distribution od static parameters by groups (col = groupby) The function needs a group_dict: dictionary {groupby_value : color} Sel_col allows to select a subset of the columns

Parameters:
  • df_plot

  • x_axis

  • group_dict

  • sel_col

  • title

  • col_num

Returns: