API

Documentation of the charticle APIs.

Venn diagrams in charticle.venn

Venn diagrams with labeled regions.

class charticle.venn.FontSizes(title=20, sets=14, intersections=12)[source]

Utility class for font size tracking.

class charticle.venn.Venn2(a_name=None, b_name=None, a=None, b=None, ab=None, title=None, sizes=NOTHING, fontsizes=NOTHING, palette=NOTHING)[source]

Object for a 2-circle Venn. Set attributes at init or by assignment.

Parameters:
  • a_name (str) –
  • b_name (str) – Label text for outside the A & B circles.
  • a (str) –
  • b (str) – Label text for the 1-member crescents.
  • ab (str) – Label text for the lenticular intersection of A & B.
  • title (str) – Text for the title of the plot.
  • palette (Venn2.Palette) – a color palette for the A & B sets.
  • fontsizes (FontSizes) – the font sizes for various labels.
class Palette(a='red', b='green', alpha=0.4)[source]

Container of color palette for both sets.

Parameters:
  • a,b (legal html colornames or hex codes) – color names for the two sets.
  • alpha (float in [0,1]) – color combination alpha for intersection.

TODO: add some default “constant” palettes.

class Venn2.Sizes(a=1.0, b=1.0, c=1.0, ab=1.0, normalize=1.0)[source]

Utility class for shaping the Venn2.

Venn2.plot(ax=None)[source]

Produce a plot on the specified axes.

Puts label strings in the right places and produces the figure.

ax: the axis on which to plot this diagram. Defaults to current axes.

class charticle.venn.Venn3(a_name=None, b_name=None, c_name=None, a=None, b=None, c=None, ab=None, bc=None, ac=None, abc=None, title=None, sizes=NOTHING, fontsizes=NOTHING, palette=NOTHING)[source]

Object for a 3-label venn. Set attributes at init or by assignment.

Parameters:
  • a_name (str) –
  • b_name (str) –
  • c_name (str) – Label text for the outer circles.
  • a (str) –
  • b (str) –
  • c (str) – Label text for the 1-member patches.
  • ab (str) –
  • ac (str) –
  • bc (str) – Label text for the 2-set-intersection patches.
  • abc (str) – Label text for the full 3-set intersection.
  • title (str) – Text for the title of the plot.
  • palette (Venn3.Palette) – a color palette for the sets.
  • sizes (Venn3.Sizes) – the region sizes (relative to 1.0).
  • fontsizes (FontSizes) – the font sizes for various labels.
class Palette(a='red', b='green', c='blue', alpha=0.4)[source]

Container of color palette for all 3 items.

Parameters:
  • a,b,c (legal html colornames or hex codes) – color names for the three sets.
  • alpha (float in [0,1]) – color combination alpha for intersections.

TODO: add some default “constant” palettes.

class Venn3.Sizes(a=1.0, b=1.0, c=1.0, ab=1.0, ac=1.0, bc=1.0, abc=1.0, normalize=1.0)[source]

Utility class for shaping the Venn3.

Venn3.plot(ax=None)[source]

Produce a plot on the specified axes.

Puts label strings in the right places and produces the figure.

ax: the axis on which to plot this diagram. Defaults to current axes.

Hierarchy pyramids in charticle.hierarchy

class charticle.hierarchy.Hierarchy(scale=1.0, polygon=NOTHING, layers=NOTHING, layer_polygon_defaults=NOTHING, layer_text_defaults=NOTHING, color_cycle=cycler('color', ['red', 'orange', 'yellow', 'green', 'blue', 'purple']))[source]

Draws a ‘Maslow-style’ hierarchy.

class Layer(label, lower, upper, polygon=NOTHING, text=NOTHING)[source]

Container for layer information.

plot(hierarchy, ax, default_color=None)[source]

Adds this layer to the hierarchy.

Hierarchy.plot(ax=None)[source]

Write the hierarchy (onto specified axes, if given).

Hierarchy.set_color_cycle(*colors)[source]

Sets color cycle from iterable of color names.

Parameters:colors (valid matplotlib color names.) – color names or None.
Hierarchy.set_layers(layers_list)[source]

Write text labels into parameters.