labplotlib 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- labplotlib/Styling.py +20 -0
- labplotlib/Symbols.py +142 -0
- labplotlib/__init__.py +3 -0
- labplotlib-0.1.0.dist-info/METADATA +58 -0
- labplotlib-0.1.0.dist-info/RECORD +7 -0
- labplotlib-0.1.0.dist-info/WHEEL +5 -0
- labplotlib-0.1.0.dist-info/top_level.txt +1 -0
labplotlib/Styling.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import seaborn as sns
|
|
2
|
+
from matplotlib import pyplot as plt
|
|
3
|
+
|
|
4
|
+
sns.set_theme(style="darkgrid", rc={"axes.facecolor": ".9"})
|
|
5
|
+
|
|
6
|
+
def _style_axis(ax, title, xlabel, ylabel):
|
|
7
|
+
ax.set(
|
|
8
|
+
xlabel=xlabel,
|
|
9
|
+
ylabel=ylabel
|
|
10
|
+
)
|
|
11
|
+
ax.set_title(title, fontdict={"fontsize": 14, "fontweight": "bold"})
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _finish_plot(fig, filename, save_directory):
|
|
15
|
+
fig.tight_layout()
|
|
16
|
+
fig.savefig(f"{save_directory}/{filename}")
|
|
17
|
+
plt.show()
|
|
18
|
+
|
|
19
|
+
if __name__ == "__main__":
|
|
20
|
+
pass
|
labplotlib/Symbols.py
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
from types import MappingProxyType
|
|
2
|
+
|
|
3
|
+
symbols = MappingProxyType(
|
|
4
|
+
{
|
|
5
|
+
"set_empty": "∅",
|
|
6
|
+
"set_union": "∪",
|
|
7
|
+
"set_intersection": "∩",
|
|
8
|
+
"set_is_element_of": "∈",
|
|
9
|
+
"set_is_not_element_of": "∉",
|
|
10
|
+
"set_is_subset_of": "⊆",
|
|
11
|
+
"set_is_proper_subset_of": "⊂",
|
|
12
|
+
"set_is_not_subset_of": "⊄",
|
|
13
|
+
"set_is_superset_of": "⊇",
|
|
14
|
+
"set_is_proper_superset_of": "⊃",
|
|
15
|
+
"set_is_not_superset_of": "⊅",
|
|
16
|
+
"set_universal": "ξ",
|
|
17
|
+
"set_minus": "∖",
|
|
18
|
+
"set_cartesian_product": "×",
|
|
19
|
+
"set_difference": "\\",
|
|
20
|
+
"delta": "Δ",
|
|
21
|
+
"set_cardinality": "|",
|
|
22
|
+
"set_complement": "'",
|
|
23
|
+
"set_power_set": "ℙ",
|
|
24
|
+
"set_contains_as_member": "∋",
|
|
25
|
+
"set_does_not_contain_as_member": "∌",
|
|
26
|
+
"complex_numbers": "ℂ",
|
|
27
|
+
"real_numbers": "ℝ",
|
|
28
|
+
"rational_numbers": "ℚ",
|
|
29
|
+
"integers": "ℤ",
|
|
30
|
+
"natural_numbers": "ℕ",
|
|
31
|
+
"superscript_i": "ⁱ",
|
|
32
|
+
"superscript_n": "ⁿ",
|
|
33
|
+
"superscript_plus_sign": "⁺",
|
|
34
|
+
"superscript_minus": "⁻",
|
|
35
|
+
"superscript_zero_0": "⁰",
|
|
36
|
+
"superscript_one_1": "¹",
|
|
37
|
+
"squared": "²",
|
|
38
|
+
"superscript_three_3": "³",
|
|
39
|
+
"superscript_four_4": "⁴",
|
|
40
|
+
"superscript_five_5": "⁵",
|
|
41
|
+
"superscript_six_6": "⁶",
|
|
42
|
+
"superscript_seven_7": "⁷",
|
|
43
|
+
"superscript_eight_8": "⁸",
|
|
44
|
+
"superscript_nine_9": "⁹",
|
|
45
|
+
"subscript_zero_0": "₀",
|
|
46
|
+
"subscript_one_1": "₁",
|
|
47
|
+
"subscript_two_2": "₂",
|
|
48
|
+
"subscript_three_3": "₃",
|
|
49
|
+
"subscript_four_4": "₄",
|
|
50
|
+
"subscript_five_5": "₅",
|
|
51
|
+
"subscript_six_6": "₆",
|
|
52
|
+
"subscript_seven_7": "₇",
|
|
53
|
+
"subscript_eight_8": "₈",
|
|
54
|
+
"subscript_nine_9": "₉",
|
|
55
|
+
"fraction_one_half_1_2": "½",
|
|
56
|
+
"fraction_zero_thirds_0_3": "↉",
|
|
57
|
+
"fraction_one_third_1_3": "⅓",
|
|
58
|
+
"fraction_two_thirds_2_3": "⅔",
|
|
59
|
+
"fraction_one_quarter_1_4": "¼",
|
|
60
|
+
"fraction_three_quarters_3_4": "¾",
|
|
61
|
+
"fraction_one_fifth_1_5": "⅕",
|
|
62
|
+
"fraction_two_fifths_2_5": "⅖",
|
|
63
|
+
"fraction_three_fifths_3_5": "⅗",
|
|
64
|
+
"fraction_four_fifths_4_5": "⅘",
|
|
65
|
+
"fraction_one_sixth_1_6": "⅙",
|
|
66
|
+
"fraction_five_sixths_5_6": "⅚",
|
|
67
|
+
"fraction_one_seventh_1_7": "⅐",
|
|
68
|
+
"fraction_one_eighth_1_8": "⅛",
|
|
69
|
+
"fraction_three_eighths_3_8": "⅜",
|
|
70
|
+
"fraction_five_eighths_5_8": "⅝",
|
|
71
|
+
"fraction_seven_eighths_7_8": "⅞",
|
|
72
|
+
"fraction_one_ninth_1_9": "⅑",
|
|
73
|
+
"fraction_one_tenth_1_10": "⅒",
|
|
74
|
+
"degree": "°",
|
|
75
|
+
"degree_celsius": "°C",
|
|
76
|
+
"degree_fahrenheit": "°F",
|
|
77
|
+
"diameter": "⌀",
|
|
78
|
+
"multiplication": "✕",
|
|
79
|
+
"division": "÷",
|
|
80
|
+
"left_floor": "⌊",
|
|
81
|
+
"right_floor": "⌋",
|
|
82
|
+
"left_ceiling": "⌈",
|
|
83
|
+
"right_ceiling": "⌉",
|
|
84
|
+
"product": "∏",
|
|
85
|
+
"coproduct": "∐",
|
|
86
|
+
"summation": "∑",
|
|
87
|
+
"summation_top": "⎲",
|
|
88
|
+
"summation_bottom": "⎳",
|
|
89
|
+
"partial_differential": "∂",
|
|
90
|
+
"integral": "∫",
|
|
91
|
+
"top_half_integral": "⌠",
|
|
92
|
+
"bottom_half_integral": "⌡",
|
|
93
|
+
"not_sign": "¬",
|
|
94
|
+
"+/-": "±",
|
|
95
|
+
"square_root": "√",
|
|
96
|
+
"cube_root": "∛",
|
|
97
|
+
"fourth_root": "∜",
|
|
98
|
+
"proportional_to": "∝",
|
|
99
|
+
"infinity": "∞",
|
|
100
|
+
"right_angle": "∟",
|
|
101
|
+
"angle": "∠",
|
|
102
|
+
"therefore": "∴",
|
|
103
|
+
"approximately_equal_to": "≅",
|
|
104
|
+
"not_equal_to": "≠",
|
|
105
|
+
"less_than_or_equal_to": "≤",
|
|
106
|
+
"greater_than_or_equal_to": "≥",
|
|
107
|
+
"right_angle_with_arc": "⊾",
|
|
108
|
+
"right_triangle": "⊿",
|
|
109
|
+
"dot_operator": "⋅",
|
|
110
|
+
"sigma": "σ",
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def search(namelike: str) -> MappingProxyType:
|
|
116
|
+
|
|
117
|
+
"""
|
|
118
|
+
Return a dictionary of symbols with names
|
|
119
|
+
containing namelike argument
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
filtered = {k: v for k, v in symbols.items() if namelike in k}
|
|
123
|
+
|
|
124
|
+
return MappingProxyType(filtered)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def print_symbols(symbols_to_print:MappingProxyType = symbols) -> None:
|
|
128
|
+
|
|
129
|
+
"""
|
|
130
|
+
Prints symbols in the symbols argument,
|
|
131
|
+
or all if this is omitted
|
|
132
|
+
"""
|
|
133
|
+
|
|
134
|
+
for symbol in symbols_to_print.keys():
|
|
135
|
+
|
|
136
|
+
print(f"{symbol.ljust(32, ' ')}", end="")
|
|
137
|
+
|
|
138
|
+
print(f" {symbols_to_print[symbol]}", end="")
|
|
139
|
+
|
|
140
|
+
print(f" decimal: {str(ord(symbols_to_print[symbol])).ljust(5, ' ')}", end="")
|
|
141
|
+
|
|
142
|
+
print(f" hexadecimal: \\u{hex(ord(symbols_to_print[symbol]))[2:]}")
|
labplotlib/__init__.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: labplotlib
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Plot styling helpers and searchable mathematical symbols.
|
|
5
|
+
Classifier: Programming Language :: Python :: 3
|
|
6
|
+
Classifier: Operating System :: OS Independent
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: matplotlib>=3.5
|
|
10
|
+
Requires-Dist: seaborn>=0.11.2
|
|
11
|
+
|
|
12
|
+
# LabPlotLib
|
|
13
|
+
|
|
14
|
+
LabPlotLib is a small Python library containing plotting-style helpers and a
|
|
15
|
+
searchable collection of mathematical symbols.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Install the latest source checkout with pip:
|
|
20
|
+
|
|
21
|
+
```powershell
|
|
22
|
+
python -m pip install .
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For development, install it in editable mode:
|
|
26
|
+
|
|
27
|
+
```powershell
|
|
28
|
+
python -m pip install -e .
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Symbol utilities
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from labplotlib import print_symbols, search, symbols
|
|
35
|
+
|
|
36
|
+
print(symbols["set_union"])
|
|
37
|
+
print(search("fraction"))
|
|
38
|
+
print_symbols(search("fraction_one"))
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The `symbols` mapping is read-only. `search(name_part)` returns a read-only
|
|
42
|
+
mapping containing symbol names that include `name_part`.
|
|
43
|
+
|
|
44
|
+
Importing `labplotlib.Styling` applies the library's Seaborn plotting theme.
|
|
45
|
+
|
|
46
|
+
## Publishing
|
|
47
|
+
|
|
48
|
+
Publishing is automated when a GitHub Release is published. Configure a PyPI
|
|
49
|
+
trusted publisher for this repository with:
|
|
50
|
+
|
|
51
|
+
- Owner and repository: the values for this GitHub project
|
|
52
|
+
- Workflow: `.github/workflows/publish.yml`
|
|
53
|
+
- Environment: `pypi`
|
|
54
|
+
|
|
55
|
+
Then update the version in `pyproject.toml`, push the change, and create a
|
|
56
|
+
GitHub Release with a matching version tag (for example, `v0.1.1`). The
|
|
57
|
+
workflow runs the tests, builds the distributions, and publishes them without
|
|
58
|
+
requiring a PyPI API token in GitHub secrets.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
labplotlib/Styling.py,sha256=EV1R6gRcERnbtpuyA9XVucI-4sYmaJl4pd2c-mVJ6i0,502
|
|
2
|
+
labplotlib/Symbols.py,sha256=iQVXY3NPSqq0tVEp7o1mHROvIkBrNeXcT4ECC9l6SoY,4667
|
|
3
|
+
labplotlib/__init__.py,sha256=nkMH8auQivc9vbjZaFyAsZ5rM_Jqisl4PxTsxAZeYe0,105
|
|
4
|
+
labplotlib-0.1.0.dist-info/METADATA,sha256=QfPmJPPBPFx-SE0qwlGCr_XW_5a2MWwh-AX6ud2yKAE,1668
|
|
5
|
+
labplotlib-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
6
|
+
labplotlib-0.1.0.dist-info/top_level.txt,sha256=n1nselG8yl820GQWj11wPJIjWlToFxTfK2nIOc1x7VU,11
|
|
7
|
+
labplotlib-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
labplotlib
|