HistogramView#
- class cegalprizm.investigator.HistogramView(investigation: cegalprizm.investigator.inv.investigation.Investigation)#
A class representing a HistogramView
The view defines how a histogram should be displayed. It allows control of both what data should be displayed and how the the data should be rendered.
Functions
__init__
(investigation)apply_weighting
(apply_weighting)Set whether to apply weighting to the histogram values
copy
()Create a copy of this view
create_dimension_views
([dimensions])Creates a copy of this view for each dimension specified
get_json
()Gets the json string representing the current view
set_barchart
(barchart_option)Set the bar chart option to be displayed
set_barchart_statistic
(barchart_statistic)Set the bar chart statistic to be displayed
set_color_by
(color_by_option)Sets what attribute in the investigation is used to determine the color of the data in the view
set_colorscale_location
(inside_viewport, ...)Set where in the plot the points colorscale is to be shown.
set_count_axis
(count_type)Set the what values should be used for the histogram count axis
set_dataset_priority
(dataset_names)Set the priority order of the datasets
set_datasets_visible
(dataset_names)Set which datasets should be visible in the view
set_dimension
(dimension)Sets the dimension to be shown in the histogram
set_dimensions
(dimension_names)Sets the dimensions to be shown in the multi histogram
set_discrete_visible
(tags)Set which discrete tags should be visible in the view
set_draw_statistics
(draw_statistics)Set whether the statistics should be shown
set_highlight
(highlight_option)Sets what discrete attribute in the investigation is used as the highlight option in the view
set_legend_location
(inside_viewport, location)Set where in the plot the legend is to be shown
set_split_by
(split_by_option)Sets what discrete attribute in the investigation is used to split the plots in the view
show_colorscale
(show)Set whether the points colorscale is shown
show_colorscale_frame
(show_frame)Set whether the frame should be shown around the points colorscale
show_data
(show)Set whether the data should be shown
show_filled_histogram
(filled)Set whether the histogram data should be shown as filled
show_histogram_as
(bars_lines)Set whether the histogram data should be drawn as bars or lines
show_legend
(show)Set whether the legend is shown
show_legend_frame
(show_frame)Set whether the frame should be shown around the legend
show_multi_histograms
(show)Set whether the histogram should be shown as a multi-dimension histogram
show_stacked_histogram
(stacked)Set whether the histogram data should be shown as stacked
Toggle whether the axes should be swapped in the view
- apply_weighting(apply_weighting: bool)#
Set whether to apply weighting to the histogram values
- Parameters
apply_weighting (bool) – If True then weighting will be applied to the histogram
- copy()#
Create a copy of this view
- Returns
the copied view
- Return type
- create_dimension_views(dimensions: Union[str, Sequence[str]] = 'all') List[cegalprizm.investigator.views.predefined_view_tuple.PredefinedViewTuple] #
Creates a copy of this view for each dimension specified
- Parameters
dimensions (Union[str, Sequence[str]], optional) – Defaults to ‘all’. - ‘all’ will duplicate the view for all the continuous dimensions in the investigation - a list of continuous dimensions to be used
- Returns
a list of views; one per specified dimension
- Return type
List[PredefinedViewTuple]
- get_json() str #
Gets the json string representing the current view
- Returns
The json string
- Return type
str
- set_barchart(barchart_option: str)#
Set the bar chart option to be displayed
- Parameters
barchart_option (str) – The name of the discrete dimension to be used
- Raises
ValueError – if the discrete dimension is not valid in the investigation
- set_barchart_statistic(barchart_statistic: str)#
Set the bar chart statistic to be displayed
- Parameters
barchart_statistic (str) – The name of the statistic to be used in the bar chart
- Raises
ValueError – if the barchart statistic is not valid
- set_color_by(color_by_option: str)#
Sets what attribute in the investigation is used to determine the color of the data in the view
- Parameters
color_by_option (str) – The name of the attribute in the investigation
- Raises
ValueError – if the color_by_option is not valid
- set_colorscale_location(inside_viewport: bool, location: str)#
Set where in the plot the points colorscale is to be shown.
Valid locations outside viewport are ‘left’ or ‘right’ Valid locations inside viewport are ‘top-left’ or ‘top-right’ or ‘bottom-left’ or ‘bottom-right’
- Parameters
inside_viewport (bool) – If True, the colorscale will be shown inside the viewport
location (str) – A string indicating the desired location of the colorscale
- Raises
ValueError – if the location is not a valid string
- set_count_axis(count_type: str)#
Set the what values should be used for the histogram count axis
- Parameters
count_type (str) – A string describing what values should be used on the count axis
- Raises
ValueError – if count_type is not a valid string
- set_dataset_priority(dataset_names: Sequence[str])#
Set the priority order of the datasets
- Parameters
dataset_names (Sequence[str]) – A list of dataset names in priority order
- Raises
ValueError – if any dataset_names are not valid
- set_datasets_visible(dataset_names: Sequence[str])#
Set which datasets should be visible in the view
By default, all datasets will be visible in the view.
Note: This new list of datasets will replace any previous list supplied.
- Parameters
dataset_names (Sequence[str]) – A list of dataset names to be made visible
- Raises
ValueError – if any dataset_names are not valid
- set_dimension(dimension: str)#
Sets the dimension to be shown in the histogram
- Parameters
dimension (str) – The name of the dimension to be used
- Raises
ValueError – if the dimension is not a valid continuous dimension
- set_dimensions(dimension_names: Sequence[str])#
Sets the dimensions to be shown in the multi histogram
- Parameters
dimension_names (Sequence[str]) – A list of the names of the dimensions to be used
- Raises
ValueError – if the dimension is not a valid continuous dimension
- set_discrete_visible(tags: Dict[str, List[str]])#
Set which discrete tags should be visible in the view
By default, all discrete tags will be visible in the view.
Note: This new list of discrete tags will replace any previous list supplied.
- Parameters
tags (Sequence[str]) – The list of discrete tags to be made visible
- Raises
ValueError – if any tags are not valid
- set_draw_statistics(draw_statistics: bool)#
Set whether the statistics should be shown
- Parameters
show (bool) – Should the statistics be shown
- set_highlight(highlight_option: str)#
Sets what discrete attribute in the investigation is used as the highlight option in the view
- Parameters
highlight_option (str) – The name of the attribute in the investigation
- Raises
ValueError – if the highlight_option is not valid
- set_legend_location(inside_viewport: bool, location: str)#
Set where in the plot the legend is to be shown
Valid locations outside viewport are ‘left’ or ‘right’ Valid locations inside viewport are ‘top-left’ or ‘top-right’ or ‘bottom-left’ or ‘bottom-right’
- Parameters
inside_viewport (bool) – If True, the legend will be shown inside the viewport
location (str) – A string indicating the desired location of the legend
- Raises
ValueError – if the location is not a valid string
- set_split_by(split_by_option: str)#
Sets what discrete attribute in the investigation is used to split the plots in the view
- Parameters
split_by_option (str) – The name of the attribute in the investigation
- Raises
ValueError – if the split_by_option is not valid
- show_colorscale(show: bool)#
Set whether the points colorscale is shown
- Parameters
show (bool) – Should the colorscale be shown
- show_colorscale_frame(show_frame: bool)#
Set whether the frame should be shown around the points colorscale
- Parameters
show (bool) – Should the colorscale be shown
- show_data(show: bool)#
Set whether the data should be shown
- Parameters
show (bool) – Should the data be shown
- show_filled_histogram(filled: bool)#
Set whether the histogram data should be shown as filled
- Parameters
filled (bool) – Should the histogram be shown filled
- show_histogram_as(bars_lines: str)#
Set whether the histogram data should be drawn as bars or lines
- Parameters
bars_lines (str) – A string describing how the histogram data should be shown
- Raises
ValueError – if bars_lines is not a valid string
- show_legend(show: bool)#
Set whether the legend is shown
- Parameters
show (bool) – Should the legend be shown
- show_legend_frame(show_frame: bool)#
Set whether the frame should be shown around the legend
The default value is True.
- Parameters
show_frame (bool) – If True; a frame will be shown around the legend
- show_multi_histograms(show: bool)#
Set whether the histogram should be shown as a multi-dimension histogram
- Parameters
show (bool) – Should the multi-dimension histogram be shown
- show_stacked_histogram(stacked: bool)#
Set whether the histogram data should be shown as stacked
- Parameters
stacked (bool) – Should the histogram be shown stacked
- swap_axes()#
Toggle whether the axes should be swapped in the view