webviz visualizations¶
-
class
webviz_plotly.
FilteredPlotly
(data, check_box_columns=[], slider_columns=[], dropdown_columns=[], *args, **kwargs)[source]¶ Bases:
webviz_plotly.Plotly
Page Element for adding filtering controls to Plotly plots that take a dataframe. Values are grouped by labels, for instance:
index,value,labels 01-01-2020,3,A 02-01-2020,4,B
If ‘labels’ is chosen as a dropdown_column, then the value 4 will be chosen if the dropdown menu is set to the label B, and the value 3 will be chosen if the dropdown is set to A.
The
FilteredPlotly.process_data()
handles the generation of the plot data. For the example above, it is given the following dataframes:index,value 01-01-2020,3
and
index,value, 02-01-2020,4
Layout and config is then generated that insert the required controls.
Parameters: - data – A dataframe, or list of dataframes, that can be processed by process_data. Each dataframe will be grouped based on check_box_columns and given as a parameter list to process data. A special label, FilteredPlotly.wildcard (‘*’ by default), signifies that the data should be present in all groups. If a dataframe does not contain a column it is treated as if all rows have the wildcard label.
- check_box_columns – Columns in the dataframes that contain labels to be filtered on by check boxes.
- slider_columns – Columns in the dataframe that contain labels to be filtered on by a slider.
- dropdown_columns – Columns in the dataframe that contain labels to be filtered on by a dropdown menu.
-
get_template
()[source]¶ overrides
webviz.PageElement.get_template()
.
-
wildcard
= '*'¶
-
class
webviz_plotly.
Plotly
(data, layout={}, config={}, **kwargs)[source]¶ Bases:
webviz._json_page_element.JSONPageElement
Plotly page element. Arguments are the same as
plotly.plot()
from plotly.js. See https://plot.ly/javascript/ for usage.Parameters: - xaxis – Will create a label for the x-axis.
- yaxis – Will create a label for the y-axis.
- logx – boolean value to toggle x-axis logarithmic scale.
- logy – boolean value to toggle y-axis logarithmic scale.
- xrange – list of minimum and maximum value. Ex: [3, 15].
- yrange – list of minimum and maximum value. Ex: [3, 15].
Note
Plotly
will not allow the modebarbuttons inDISALLOWED_BUTTONS
, as these are not useful for the visualizations implemented in webviz.-
DISALLOWED_BUTTONS
= ['sendDataToCloud', 'resetScale2d']¶
-
get_template
()[source]¶ Overrides
webviz.PageElement.get_template()
.
-
class
webviz_bar_chart.
BarChart
(data, barmode='group', logy=False, *args, **kwargs)[source]¶ Bases:
webviz_plotly.FilteredPlotly
Bar chart page element.
Parameters: - data – Either a file path to a csv file or a
pandas.DataFrame
. If a dataframe is given, each column is one set of bars in the chart. The dataframe index is used for the horizontal values. Similarly for the csv file, where a special column namedindex
will be used for the horizontal values. - barmode – Either
'group'
,'stack'
,'relative'
or'overlay'
. Defines how multiple bars per index-value are combined. See plotly.js layout-barmode.
- data – Either a file path to a csv file or a
-
class
webviz_heat_map.
HeatMap
(data, *args, **kwargs)[source]¶ Bases:
webviz_plotly.FilteredPlotly
Line chart page element.
Parameters: data – Either a file path to a csv file or a pandas.DataFrame
. Each column of the dataframe becomes one line in the chart. Similarly for the csv file, but a special columnindex
will be used as the horizontal value.
-
class
webviz_histogram.
Histogram
(data, xlabel=None, ylabel='[%]', barmode='overlay', histnorm='percent', nbinsx=0, logy=False, logx=False, *args, **kwargs)[source]¶ Bases:
webviz_plotly.FilteredPlotly
Histogram page element.
Parameters: - data – Either a file path to a csv file or a
pandas.DataFrame
. If a dataframe is given, each column is one set of bars in the chart. The dataframe index is used for the horizontal values. Similarly for the csv file, where a special column namedindex
will be used for the horizontal values. - barmode –
Either
'group'
,'stack'
,'relative'
or'overlay'
. Defines how multiple bars per index-value are combined. See plotly.js layout-barmode. - histnorm – Either
''
,'percent'
,'probability'
,'density'
or'probability density'
. Spesifies type of normalization used. See plotly.js histogram-histnorm. - nbinsx – Maximum number of desired bins. Default value
0
will generate optimal number of bins.
- data – Either a file path to a csv file or a
-
class
webviz_line_chart.
LineChart
(data, logy=False, *args, **kwargs)[source]¶ Bases:
webviz_plotly.FilteredPlotly
Line chart page element.
Parameters: data – Either a file path to a csv file or a pandas.DataFrame
. If a dataframe is given, each column is one line in the chart. The dataframe index is used for the horizontal values. Similarly for the csv file, where a special column namedindex
will be used for the horizontal values.
-
class
webviz_pie_chart.
PieChart
(data, num_per_row=4)[source]¶ Bases:
webviz_plotly.Plotly
Pie chart page element.
Parameters: - data – Value for each sector, or csv file (one column for each sector). Each row (line) becomes a separate pie chart. If there is a column with the name ‘pie_chart_label’ it is used for the name of each pie chart.
- num_per_row – If more than one pie chart, number per row.
-
class
webviz_scatter_plot.
ScatterPlot
(data, logy=False, *args, **kwargs)[source]¶ Bases:
webviz_plotly.FilteredPlotly
Scatter plot page element.
Parameters: data – Either a file path to a csv file or a pandas.DataFrame
. If a dataframe is given, each column is one set of points in the chart. The dataframe index is used for the horizontal values. Similarly for the csv file, where a special column namedindex
will be used for the horizontal values.
-
class
webviz_tornado_plot.
TornadoPlot
(*args, **kwargs)[source]¶ Bases:
webviz_plotly.FilteredPlotly
Tornado plot page element.
Parameters: - data – Either a file path to a csv file or a
pandas.DataFrame
. There are two columns: ‘low’ and ‘high’ describing. - high_text – Optional text
- data – Either a file path to a csv file or a