publiplots.set_hatch_mode

publiplots.set_hatch_mode(mode=None)[source]

Set the global hatch pattern density mode.

This setting affects all subsequent hatch pattern generation unless explicitly overridden. The mode determines the density of hatch patterns:

  • Mode 1: base × 1 patterns (e.g., ‘/’, ‘.’) - recommended

  • Mode 2: base × 2 patterns (e.g., ‘//’, ‘..’) - medium density

  • Mode 3: base × 3 patterns (e.g., ‘///’, ‘…’) - dense

  • Mode 4: base × 4 patterns (e.g., ‘////’, ‘….’) - dense

Parameters:

mode (int, optional) – Pattern density mode. Must be 1, 2, 3, or 4. If None, resets to DEFAULT_HATCH_MODE from config.

Raises:

ValueError – If mode is not None, 1, 2, 3, or 4.

Examples

Set to sparse patterns (mode 1): >>> import publiplots as pp >>> pp.set_hatch_mode(1) >>> fig, ax = pp.barplot(data=df, x=’x’, y=’y’, hue=’category’)

Set to dense patterns for small figures: >>> pp.set_hatch_mode(3) >>> fig, ax = pp.barplot(data=df, x=’x’, y=’y’, hue=’category’, … figsize=(3, 2))

Reset to default mode: >>> pp.set_hatch_mode() # or pp.set_hatch_mode(None) >>> pp.get_hatch_mode() 1

Notes

This is a global setting that persists across function calls within the same session. To reset to the default, call set_hatch_mode() with no arguments or set_hatch_mode(None).