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.,
'/','.') — sparse.Mode 2: base × 2 patterns (e.g.,
'//','..') — medium.Mode 3: base × 3 patterns (e.g.,
'///','...') — dense.Mode 4: base × 4 patterns (e.g.,
'////','....') — very dense.
Writes to
pp.rcParams["hatch_mode"].- Parameters:
mode (int, optional) – Pattern density mode. Must be
1,2,3, or4. IfNone, resets to the package default (1).- Raises:
ValueError – If
modeis notNone,1,2,3, or4.
Examples
Set to sparse patterns (mode 1):
>>> import publiplots as pp >>> pp.set_hatch_mode(1) >>> fig, ax = pp.subplots() >>> pp.barplot(data=df, x='x', y='y', hue='category', hatch=True, ax=ax)
Set to dense patterns:
>>> pp.set_hatch_mode(3)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 revert, call
set_hatch_mode()with no arguments (orNone).See also
get_hatch_modeRead the current mode.
get_hatch_patternsMaterialise the pattern list for a mode.