HistogramViewerState

Contents

HistogramViewerState#

class glue.viewers.histogram.state.HistogramViewerState(**kwargs)[source]#

Bases: MatplotlibDataViewerState

A state class that includes all the attributes for a histogram viewer.

Attributes Summary

aspect

Aspect ratio for the axes

bins

The position of the bins for the histogram based on the current state.

common_n_bin

The number of bins to use for all numerical components

cumulative

Whether to show the histogram as a cumulative histogram

hist_n_bin

The number of bins in the histogram

hist_x_max

The maximum value used to compute the histogram

hist_x_min

The minimum value used to compute the histogram

layers

A collection of all layers in the viewer

layers_data

normalize

Whether to normalize the histogram (based on the total sum)

random_subset

The maximum number of elements to use when computing the histogram.

show_axes

Whether the axes are shown

title

The title of the viewer

update_bins_on_reset_limits

Whether to update the bins to match the view when resetting limits

x_att

The attribute to compute the histograms for

x_axislabel

Label for the x-axis

x_axislabel_size

Size of the x-axis label

x_axislabel_weight

Weight of the x-axis label

x_categories

x_kinds

x_limits_percentile

Percentile to use when automatically determining x limits

x_log

Whether the x axis is logarithmic

x_max

Upper limit of the visible x range

x_min

Lower limit of the visible x range

x_ticklabel_size

Size of the x-axis tick labels

y_axislabel

Label for the y-axis

y_axislabel_size

Size of the y-axis label

y_axislabel_weight

Weight of the y-axis label

y_log

Whether the y axis is logarithmic

y_max

Upper limit of the visible y range

y_min

Lower limit of the visible y range

y_ticklabel_size

Size of the y-axis tick labels

Methods Summary

add_callback(name, callback[, echo_old, ...])

Add a callback that gets triggered when a callback property of the class changes.

add_global_callback(callback)

Add a global callback function, which is a callback that gets triggered when any callback properties on the class change.

as_dict()

Return the current state as a dictionary of attribute/value pairs.

callback_properties()

clear_callbacks()

Remove all global and property-specific callbacks.

flip_x()

Flip the x_min/x_max limits.

is_callback_property(name)

Whether a property (identified by name) is a callback property.

iter_callback_properties()

Iterator to loop over all callback properties.

remove_callback(name, callback)

Remove a previously-added callback

remove_global_callback(callback)

Remove a global callback function.

reset_limits()

update_axes_settings_from(state)

update_bins_to_view(*args, **kwargs)

update_from_dict(properties)

Update this state using the values from a dictionary of attributes.

update_from_state(state)

Update this state using the values from another state.

update_view_to_bins(*args, **kwargs)

Attributes Documentation

aspect#

Aspect ratio for the axes

bins[source]#

The position of the bins for the histogram based on the current state.

common_n_bin#

The number of bins to use for all numerical components

cumulative#

Whether to show the histogram as a cumulative histogram

hist_n_bin#

The number of bins in the histogram

hist_x_max#

The maximum value used to compute the histogram

hist_x_min#

The minimum value used to compute the histogram

layers#

A collection of all layers in the viewer

layers_data#
normalize#

Whether to normalize the histogram (based on the total sum)

random_subset#

The maximum number of elements to use when computing the histogram. If the data is larger than this, a random subset of the data will be used.

show_axes#

Whether the axes are shown

title#

The title of the viewer

update_bins_on_reset_limits#

Whether to update the bins to match the view when resetting limits

x_att#

The attribute to compute the histograms for

x_axislabel#

Label for the x-axis

x_axislabel_size#

Size of the x-axis label

x_axislabel_weight#

Weight of the x-axis label

x_categories[source]#
x_kinds[source]#
x_limits_percentile#

Percentile to use when automatically determining x limits

x_log#

Whether the x axis is logarithmic

x_max#

Upper limit of the visible x range

x_min#

Lower limit of the visible x range

x_ticklabel_size#

Size of the x-axis tick labels

y_axislabel#

Label for the y-axis

y_axislabel_size#

Size of the y-axis label

y_axislabel_weight#

Weight of the y-axis label

y_log#

Whether the y axis is logarithmic

y_max#

Upper limit of the visible y range

y_min#

Lower limit of the visible y range

y_ticklabel_size#

Size of the y-axis tick labels

Methods Documentation

add_callback(name, callback, echo_old=False, priority=0)#

Add a callback that gets triggered when a callback property of the class changes.

Parameters:
namestr

The instance to add the callback to.

callbackfunc

The callback function to add

echo_oldbool, optional

If True, the callback function will be invoked with both the old and new values of the property, as callback(old, new). If False (the default), will be invoked as callback(new)

priorityint, optional

This can optionally be used to force a certain order of execution of callbacks (larger values indicate a higher priority).

add_global_callback(callback)#

Add a global callback function, which is a callback that gets triggered when any callback properties on the class change.

Parameters:
callbackfunc

The callback function to add

as_dict()#

Return the current state as a dictionary of attribute/value pairs.

callback_properties()#
clear_callbacks()#

Remove all global and property-specific callbacks.

flip_x()[source]#

Flip the x_min/x_max limits.

is_callback_property(name)#

Whether a property (identified by name) is a callback property.

Parameters:
namestr

The name of the property to check

iter_callback_properties()#

Iterator to loop over all callback properties.

remove_callback(name, callback)#

Remove a previously-added callback

Parameters:
namestr

The instance to remove the callback from.

funcfunc

The callback function to remove

remove_global_callback(callback)#

Remove a global callback function.

Parameters:
callbackfunc

The callback function to remove

reset_limits()[source]#
update_axes_settings_from(state)#
update_bins_to_view(*args, **kwargs)[source]#
update_from_dict(properties)#

Update this state using the values from a dictionary of attributes.

Parameters:
propertiesdict

The dictionary containing attribute/value pairs.

update_from_state(state)#

Update this state using the values from another state.

Parameters:
state~glue.core.state_objects.State

The state to use the values from

update_view_to_bins(*args, **kwargs)[source]#