ecoscope.plotting#
Submodules#
Package Contents#
- class ecoscope.plotting.EcoPlotData(grouped, x_col='x', y_col='y', color_col=None, groupby_style=None, **style)[source]#
- grouped#
- x_col#
- y_col#
- color_col#
- groupby_style#
- style#
- ecoscope.plotting.ecoplot(data, title='', out_path=None, subplot_height=100, subplot_width=700, vertical_spacing=0.001, annotate_name_pos=(0.01, 0.99), y_title_2=None, layout_kwargs=None, **make_subplots_kwargs)[source]#
- ecoscope.plotting.stacked_bar_chart(data, agg_function, stack_column, layout_kwargs=None)[source]#
Creates a stacked bar chart from the provided EcoPlotData object :param data: The data to plot, counts categorical data.y_col values for data.x_col :type data: ecoscope.Plotting.EcoPlotData :param agg_function: The pandas.Dataframe.aggregate() function to run ie; ‘count’, ‘sum’ :type agg_function: str :param stack_column: The name of the column in the data to build stacks from, should be categorical :type stack_column: str :param layout_kwargs: Additional kwargs passed to plotly.go.Figure(layout) :type layout_kwargs: dict
- Returns:
fig – The plotly bar chart
- Return type:
plotly.graph_objects.Figure
- Parameters:
data (EcoPlotData)
agg_function (str)
stack_column (str)
layout_kwargs (dict)
- ecoscope.plotting.pie_chart(data, value_column, label_column=None, color_column=None, style_kwargs={}, layout_kwargs=None)[source]#
Creates a pie chart from the provided dataframe :param data: The data to plot :type data: pd.Dataframe :param value_column: The name of the dataframe column to pull slice values from
- If the column contains non-numeric values, it is assumed to be categorical
and the pie slices will be a count of the occurrences of the category
- Parameters:
label_column (str) – The name of the dataframe column to label slices with, required if the data in value_column is numeric
style_kwargs (dict) – Additional style kwargs passed to go.Pie()
layout_kwargs (dict) – Additional kwargs passed to plotly.go.Figure(layout)
data (pandas.DataFrame)
value_column (str)
color_column (str)
- Returns:
fig – The plotly bar chart
- Return type:
plotly.graph_objects.Figure