pocketutils.misc.j

Module Contents

class pocketutils.misc.j.J

Convenience user tools to display HTML text in Jupyter notebooks.

classmethod styled(text: str, *main, **css: str) None

Display a span element styled with free CSS arguments.

Parameters
  • text – The text to include in an HTML span

  • main – Any free text of CSS, or a list of parameters

  • css – Any free dict of CSS style parameters; spaces and underscores in the keys will be replaced with hypens

class pocketutils.misc.j.JFonts

Renders HTML for matplotlib fonts.

classmethod one(name: str) None

Shows a single typeface as itself. Ex; will show Helvetica in Helvetica.

classmethod mine() None

Shows all typefaces currently in the matplotlib rcParams. Each typeface is rendered as itself. Ex; will show Helvetica in Helvetica. Each font family (plt.rcParams['font.family']) is shown separately, with all its fonts underneath.

classmethod every(n_cols: int = 4) None

Shows an HTML table of all typefaces rendered as themselves. Ex; will show Helvetica in Helvetica. Displays as an HTML table with n_cols. Thanks to https://jonathansoma.com/lede/data-studio/matplotlib/list-all-fonts-available-in-matplotlib-plus-samples/.

Parameters

n_cols – Number of columns in the created HTML table