ecoscope.plotting.plot#
Module Contents#
- class ecoscope.plotting.plot.EcoPlotData(grouped, x_col='x', y_col='y', color_col=None, groupby_style=None, **style)[source]#
- grouped#
- x_col = 'x'#
- y_col = 'y'#
- color_col = None#
- groupby_style#
- style#
- ecoscope.plotting.plot.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.plot.plot_seasonal_dist(ndvi_vals, cuts, bandwidth=0.05, output_file=None)[source]#
- ecoscope.plotting.plot.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.plot.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
- ecoscope.plotting.plot.draw_historic_timeseries(df, current_value_column, current_value_title, historic_min_column=None, historic_max_column=None, historic_band_title='Historic Min-Max', historic_mean_column=None, historic_mean_title='Historic Mean', layout_kwargs=None, upper_lower_band_style={'mode': 'lines', 'line_color': 'green'}, historic_mean_style={'mode': 'lines', 'line': {'color': 'green', 'dash': 'dot'}}, current_value_style={'mode': 'lines', 'line_color': 'navy'}, time_column='img_date')[source]#
Creates a timeseries plot compared with historical values :param df: The data to plot :type df: pd.Dataframe :param current_value_column: The name of the dataframe column to pull slice values from :type current_value_column: str :param current_value_title: The title shown in the plot legend for current value :type current_value_title: str :param historic_min_column: The name of the dataframe column to pull historic min values from.
historic_min_column and historic_max_column should exist together.
- Parameters:
historic_max_column (str) – The name of the dataframe column to pull historic max values from. historic_min_column and historic_max_column should exist together.
historic_band_title (str) – The title shown in the plot legend for historic band
historic_mean_column (str) – The name of the dataframe column to pull historic mean values from
historic_mean_title (str) – The title shown in the plot legend for historic mean values
layout_kwargs (dict) – Additional kwargs passed to plotly.go.Figure(layout)
time_column (str) – The time column. Default: “img_date”
df (pandas.DataFrame)
current_value_column (str)
current_value_title (str)
historic_min_column (str)
upper_lower_band_style (dict)
historic_mean_style (dict)
current_value_style (dict)
- Returns:
fig – The plotly bar chart
- Return type:
plotly.graph_objects.Figure