Styling Helpers
PlotStyler class that applies styling using the context.
PlotStyler
Helper class for applying all styling - fonts, colors, and hardcoded elements.
Source code in pyretailscience/plots/styles/styling_helpers.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
|
__init__()
apply_base_styling(ax)
Apply base plot styling (spines, grid, background) - using hardcoded defaults.
Source code in pyretailscience/plots/styles/styling_helpers.py
apply_label(ax, label, axis, pad=10)
Apply axis label styling using context fonts.
Source code in pyretailscience/plots/styles/styling_helpers.py
apply_legend(ax, title=None, outside=False)
Apply legend styling using context fonts.
Source code in pyretailscience/plots/styles/styling_helpers.py
apply_source_text(ax, text, font_size=None, vertical_padding=2, is_venn_diagram=False, **kwargs)
Apply source text styling using context fonts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ax |
Axes
|
The graph to add the source text to. |
required |
text |
str
|
The source text. |
required |
font_size |
float
|
The font size of the source text. If None, uses styling context default. |
None
|
vertical_padding |
float
|
The padding in ems below the x-axis label. Defaults to 2. |
2
|
is_venn_diagram |
bool
|
Flag to indicate if the diagram is a Venn diagram.
If True, |
False
|
**kwargs |
object
|
Additional keyword arguments for positioning (x, y coordinates) |
{}
|
Returns:
Name | Type | Description |
---|---|---|
Text |
Text
|
The source text object. |
Source code in pyretailscience/plots/styles/styling_helpers.py
apply_ticks(ax)
Apply tick styling using context fonts.
Source code in pyretailscience/plots/styles/styling_helpers.py
apply_title(ax, title, pad=10)
Apply title styling using context fonts.