bqplot.marks.Mark¶
-
class
bqplot.marks.Mark(**kwargs)[source]¶ The base mark class.
Traitlet mark attributes may be decorated with metadata.
Data Attribute Decoration
Data attributes are decorated with the following values:
- scaled: bool
- Indicates whether the considered attribute is a data attribute which must be associated with a scale in order to be taken into account.
- rtype: string
- Range type of the associated scale.
- atype: string
- Key in bqplot’s axis registry of the recommended axis type to represent this scale. When not specified, the default is ‘bqplot.Axis’.
-
display_name¶ Holds a user-friendly name for the trait attribute.
Type: string
-
mark_types¶ A registry of existing mark types.
Type: dict (class-level attribute)
-
scales¶ A dictionary of scales holding scales for each data attribute. - If a mark holds a scaled attribute named ‘x’, the scales dictionary must have a corresponding scale for the key ‘x’. - The scale’s range type should be equal to the scaled attribute’s range type (rtype).
Type: Dict of scales (default: {})
-
scales_metadata¶ A dictionary of dictionaries holding metadata on the way scales are used by the mark. For example, a linear scale may be used to count pixels horizontally or vertically. The content of this dictionary may change dynamically. It is an instance-level attribute.
Type: Dict (default: {})
-
preserve_domain¶ Indicates if this mark affects the domain(s) of the specified scale(s). The keys of this dictionary are the same as the ones of the “scales” attribute, and values are boolean. If a key is missing, it is considered as False.
Type: dict (default: {})
-
display_legend¶ Display toggle for the mark legend in the general figure legend
Type: bool (default: False)
-
labels¶ Labels of the items of the mark. This attribute has different meanings depending on the type of mark.
Type: list of unicode strings (default: [])
-
apply_clip¶ Indicates whether the items that are beyond the limits of the chart should be clipped.
Type: bool (default: True)
-
visible¶ Visibility toggle for the mark.
Type: bool (default: True)
-
selected_style¶ CSS style to be applied to selected items in the mark.
Type: dict (default: {})
-
unselected_style¶ CSS style to be applied to items that are not selected in the mark, when a selection exists.
Type: dict (default: {})
-
selected¶ Indices of the selected items in the mark.
Type: list of integers or None (default: None)
-
tooltip¶ Widget to be displayed as tooltip when elements of the scatter are hovered on
Type: DOMWidget or None (default: None)
-
tooltip_style¶ Styles to be applied to the tooltip widget
Type: Dictionary (default: {‘opacity’: 0.9})
-
enable_hover¶ Boolean attribute to control the hover interaction for the scatter. If this is false, the on_hover custom mssg is not sent back to the python side
Type: Bool (default: True)
-
interactions¶ Dictionary listing the different interactions for each mark. The key is the event which triggers the interaction and the value is the kind of interactions. Keys and values can only take strings from separate enums for each mark.
Type: Dictionary (default: {‘hover’: ‘tooltip’})
-
tooltip_location¶ Enum specifying the location of the tooltip. ‘mouse’ places the tooltip at the location of the mouse when the tooltip is activated and ‘center’ places the tooltip at the center of the figure. If tooltip is linked to a click event, ‘mouse’ places the tooltip at the location of the click that triggered the tooltip to be visible.
Type: {‘mouse’, ‘center’} (default: ‘mouse’)
Methods
__init__(**kwargs)Public constructor add_traits(**traits)Dynamically add trait attributes to the Widget. class_own_trait_events(name)Get a dict of all event handlers defined on this class, not a parent. class_own_traits(**metadata)Get a dict of all the traitlets defined on this class, not a parent. class_trait_names(**metadata)Get a list of all the names of this class’ traits. class_traits(**metadata)Get a dictof all the traits of this class.close()Close method. close_all()get_manager_state([drop_defaults, widgets])Returns the full state for a widget manager for embedding get_state([key, drop_defaults])Gets the widget state, or a piece of it. get_view_spec()handle_comm_opened(comm, msg)Static method, called when a widget is constructed. has_trait(name)Returns True if the object has a trait with the specified name. hold_sync()Hold syncing any state until the outermost context manager exits hold_trait_notifications()Context manager for bundling trait change notifications and cross validation. notify_change(change)Called when a property has changed. observe(handler[, names, type])Setup a handler to be called when a trait changes. on_background_click(callback[, remove])on_click(callback[, remove])on_displayed(callback[, remove])(Un)Register a widget displayed callback. on_element_click(callback[, remove])on_hover(callback[, remove])on_legend_click(callback[, remove])on_legend_hover(callback[, remove])on_msg(callback[, remove])(Un)Register a custom msg receive callback. on_trait_change([handler, name, remove])DEPRECATED: Setup a handler to be called when a trait changes. on_widget_constructed(callback)Registers a callback to be called when a widget is constructed. open()Open a comm to the frontend if one isn’t already open. send(content[, buffers])Sends a custom msg to the widget model in the front-end. send_state([key])Sends the widget state, or a piece of it, to the front-end, if it exists. set_state(sync_data)Called when a state is received from the front-end. set_trait(name, value)Forcibly sets trait attribute, including read-only attributes. setup_instance(*args, **kwargs)This is called before self.__init__ is called. trait_events([name])Get a dictof all the event handlers of this class.trait_metadata(traitname, key[, default])Get metadata values for trait by key. trait_names(**metadata)Get a list of all the names of this class’ traits. traits(**metadata)Get a dictof all the traits of this class.unobserve(handler[, names, type])Remove a trait change handler. unobserve_all([name])Remove trait change handlers of any type for the specified name. Attributes
apply_clipA boolean (True, False) trait. commA trait whose value must be an instance of a specified class. cross_validation_lockA contextmanager for running a block with our cross validation lock set to True. display_legendA boolean (True, False) trait. enable_hoverA boolean (True, False) trait. interactionsAn instance of a Python dict. keysAn instance of a Python list. labelsAn instance of a Python list. logA trait whose value must be an instance of a specified class. mark_typesmodel_idGets the model id of this widget. preserve_domainAn instance of a Python dict. scalesAn instance of a Python dict. scales_metadataAn instance of a Python dict. selectedAn instance of a Python list. selected_styleAn instance of a Python dict. tooltipA trait whose value must be an instance of a specified class. tooltip_locationAn enum whose value must be in a given sequence. tooltip_styleAn instance of a Python dict. unselected_styleAn instance of a Python dict. visibleA boolean (True, False) trait. widget_typeswidgets