graphid.core.mixin_viz module

class graphid.core.mixin_viz.GraphVisualization[source]

Bases: object

contains plotting related code

_get_truth_colors()[source]
property _error_color
_get_cmap()[source]
initialize_visual_node_attrs(graph=None)[source]
update_node_image_config(**kwargs)[source]
update_node_image_attribute(use_image=False, graph=None)[source]
get_colored_edge_weights(graph=None, highlight_reviews=True)[source]
get_colored_weights(weights)[source]
property visual_edge_attrs

all edge visual attrs

property visual_edge_attrs_appearance

attrs that pertain to edge color and style

property visual_edge_attrs_space

attrs that pertain to edge positioning in a plot

property visual_node_attrs
simplify_graph(graph=None, copy=True)[source]
pin_node_layout()[source]

Ensures a node layout exists and then sets the pin attribute on each node, which tells graphviz not to change node positions. Useful for making before and after pictures.

update_visual_attrs(graph=None, show_reviewed_edges=True, show_unreviewed_edges=False, show_inferred_diff=True, show_inferred_same=True, show_recent_review=False, highlight_reviews=True, show_inconsistency=True, wavy=False, simple_labels=False, show_labels=True, reposition=True, use_image=False, edge_overrides=None, node_overrides=None, colorby='name_label', **kwargs)[source]
show_graph(graph=None, use_image=False, update_attrs=True, with_colorbar=False, pnum=(1, 1, 1), zoomable=True, pickable=False, **kwargs)[source]
Parameters:
  • infr (?)

  • graph (None) – (default = None)

  • use_image (bool) – (default = False)

  • update_attrs (bool) – (default = True)

  • with_colorbar (bool) – (default = False)

  • pnum (tuple) – plot number(default = (1, 1, 1))

  • zoomable (bool) – (default = True)

  • pickable (bool) – (de = False)

  • **kwargs – verbose, with_labels, fnum, layout, ax, pos, img_dict, title, layoutkw, framewidth, modify_ax, as_directed, hacknoedge, hacknode, node_labels, arrow_width, fontsize, fontweight, fontname, fontfamilty, fontproperties

Example

>>> # xdoctest: +REQUIRES(module:pygraphviz)
>>> from graphid import demo
>>> infr = demo.demodata_infr(ccs=util.estarmap(
>>>    range, [(1, 6), (6, 10), (10, 13), (13, 15), (15, 16),
>>>            (17, 20)]))
>>> pnum_ = util.PlotNums(nRows=1, nCols=3)
>>> infr.show_graph(show_cand=True, simple_labels=True, pickable=True, fnum=1, pnum=pnum_())
>>> infr.add_feedback((1, 5), INCMP)
>>> infr.add_feedback((14, 18), INCMP)
>>> infr.refresh_candidate_edges()
>>> infr.show_graph(show_cand=True, simple_labels=True, pickable=True, fnum=1, pnum=pnum_())
>>> infr.add_feedback((17, 18), NEGTV)  # add inconsistency
>>> infr.apply_nondynamic_update()
>>> infr.show_graph(show_cand=True, simple_labels=True, pickable=True, fnum=1, pnum=pnum_())
>>> util.show_if_requested()
show_edge(edge, fnum=None, pnum=None, **kwargs)[source]
debug_edge_repr()[source]
repr_edge_data(all_edge_data, visual=True)[source]
show_error_case(aids, edge=None, error_edges=None, colorby=None, fnum=1)[source]

Example

show(graph=None, use_image=False, update_attrs=True, with_colorbar=False, pnum=(1, 1, 1), zoomable=True, pickable=False, **kwargs)
Parameters:
  • infr (?)

  • graph (None) – (default = None)

  • use_image (bool) – (default = False)

  • update_attrs (bool) – (default = True)

  • with_colorbar (bool) – (default = False)

  • pnum (tuple) – plot number(default = (1, 1, 1))

  • zoomable (bool) – (default = True)

  • pickable (bool) – (de = False)

  • **kwargs – verbose, with_labels, fnum, layout, ax, pos, img_dict, title, layoutkw, framewidth, modify_ax, as_directed, hacknoedge, hacknode, node_labels, arrow_width, fontsize, fontweight, fontname, fontfamilty, fontproperties

Example

>>> # xdoctest: +REQUIRES(module:pygraphviz)
>>> from graphid import demo
>>> infr = demo.demodata_infr(ccs=util.estarmap(
>>>    range, [(1, 6), (6, 10), (10, 13), (13, 15), (15, 16),
>>>            (17, 20)]))
>>> pnum_ = util.PlotNums(nRows=1, nCols=3)
>>> infr.show_graph(show_cand=True, simple_labels=True, pickable=True, fnum=1, pnum=pnum_())
>>> infr.add_feedback((1, 5), INCMP)
>>> infr.add_feedback((14, 18), INCMP)
>>> infr.refresh_candidate_edges()
>>> infr.show_graph(show_cand=True, simple_labels=True, pickable=True, fnum=1, pnum=pnum_())
>>> infr.add_feedback((17, 18), NEGTV)  # add inconsistency
>>> infr.apply_nondynamic_update()
>>> infr.show_graph(show_cand=True, simple_labels=True, pickable=True, fnum=1, pnum=pnum_())
>>> util.show_if_requested()
graphid.core.mixin_viz.on_pick(event, infr=None)[source]
graphid.core.mixin_viz.color_nodes(graph, labelattr='label', brightness=0.878, outof=None, sat_adjust=None)[source]

Colors edges and nodes by nid

graphid.core.mixin_viz.nx_ensure_agraph_color(graph)[source]

changes colors to hex strings on graph attrs