frenchplotlib 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.
@@ -0,0 +1,125 @@
1
+ from svgpathtools import svg2paths
2
+ from svgpath2mpl import parse_path
3
+ import os
4
+ import numpy as np
5
+ from matplotlib.path import Path as MplPath
6
+
7
+ try:
8
+ from svgpathtools import svg2paths2
9
+ except ImportError:
10
+ svg2paths2 = None
11
+
12
+ name = 'escargot'
13
+ path = f'assets/{name}.svg'
14
+
15
+ # Get the directory where this file is located
16
+ current_dir = os.path.dirname(os.path.abspath(__file__))
17
+ svg_path = os.path.join(current_dir, path)
18
+
19
+ if svg2paths2:
20
+ paths, attributes, _svg_attributes = svg2paths2(svg_path)
21
+ else:
22
+ paths, attributes = svg2paths(svg_path)
23
+
24
+ if not paths:
25
+ raise ValueError(f"Aucun path trouvé dans {svg_path}")
26
+
27
+ # Convertir tous les paths en un seul Path matplotlib
28
+ all_vertices = []
29
+ all_codes = []
30
+ for p in paths:
31
+ mpl_path = parse_path(p.d())
32
+ if mpl_path.vertices.size == 0:
33
+ continue
34
+
35
+ vertices = mpl_path.vertices
36
+ codes = mpl_path.codes
37
+ if codes is None:
38
+ codes = np.full(len(vertices), MplPath.LINETO, dtype=np.uint8)
39
+ codes[0] = MplPath.MOVETO
40
+ else:
41
+ codes = codes.copy()
42
+ codes[0] = MplPath.MOVETO
43
+
44
+ all_vertices.append(vertices)
45
+ all_codes.append(codes)
46
+
47
+ data_vertices = np.vstack(all_vertices)
48
+ data_codes = np.concatenate(all_codes)
49
+
50
+ # Centrer la forme
51
+ data_vertices -= data_vertices.mean(axis=0)
52
+
53
+ # Formatter les vertices avec une ligne par élément
54
+ vertices_str = "[\n"
55
+ for vertex in data_vertices:
56
+ vertices_str += f" {vertex.tolist()},\n"
57
+ vertices_str += " ]"
58
+
59
+ # Formatter les codes sur une ligne (ils sont plus courts)
60
+ codes_str = str(data_codes.tolist())
61
+
62
+ sample = f"""
63
+ {name} = Path(
64
+ np.array({vertices_str}),
65
+ np.array({codes_str})
66
+ )
67
+ """
68
+
69
+ # ecrire à la fin du fichier breadplotlib.py
70
+ breadplotlib_path = os.path.join(current_dir, 'breadplotlib.py')
71
+ with open(breadplotlib_path, 'r') as f:
72
+ content = f.read()
73
+
74
+ # si on a le nom de la variable deja dans le fichier, ne pas l'ajouter
75
+ if f'{name} = Path(' not in content:
76
+ with open(breadplotlib_path, 'a') as f:
77
+ # S'assurer qu'il y a exactement un retour à la ligne avant
78
+ if not content.endswith('\n'):
79
+ f.write('\n')
80
+ f.write(sample + '\n')
81
+
82
+ """# ajouter dans __init__.py
83
+ init_path = os.path.join(current_dir, '__init__.py')
84
+ with open(init_path, 'r') as f:
85
+ content = f.read()
86
+
87
+ # Extraire tous les noms importés depuis breadplotlib
88
+ import_line_start = content.find('from .breadplotlib import')
89
+ if import_line_start != -1:
90
+ # Trouver la fin de toutes les lignes d'import
91
+ import_end = content.find('\n\n', import_line_start)
92
+ if import_end == -1:
93
+ import_end = content.find('__all__', import_line_start)
94
+
95
+ import_section = content[import_line_start:import_end]
96
+
97
+ # Extraire tous les noms importés
98
+ imported_names = []
99
+ for line in import_section.split('\n'):
100
+ if 'from .breadplotlib import' in line:
101
+ names = line.replace('from .breadplotlib import', '').strip()
102
+ imported_names.extend([n.strip() for n in names.split(',')])
103
+
104
+ # Ajouter le nouveau nom s'il n'existe pas
105
+ if name not in imported_names:
106
+ imported_names.append(name)
107
+
108
+ # Reconstruire la ligne d'import
109
+ new_import_line = f"from .breadplotlib import {', '.join(imported_names)}"
110
+
111
+ # Remplacer toute la section d'import par une seule ligne
112
+ new_content = content[:import_line_start] + new_import_line + '\n\n' + content[import_end:].lstrip('\n')
113
+ else:
114
+ # Si pas d'import existant, créer la première ligne
115
+ new_content = f"from .breadplotlib import {name}\n\n" + content
116
+
117
+ # Mettre à jour __all__
118
+ if f"'{name}'" not in new_content:
119
+ all_start = new_content.find("__all__ = [")
120
+ if all_start != -1:
121
+ all_end = new_content.find(']', all_start)
122
+ new_content = new_content[:all_end] + f", '{name}'" + new_content[all_end:]
123
+
124
+ with open(init_path, 'w') as f:
125
+ f.write(new_content)"""
@@ -0,0 +1,46 @@
1
+ from matplotlib.colors import LinearSegmentedColormap, ListedColormap
2
+
3
+ # Dorure du pain (blanc crème -> doré -> brun)
4
+ pain_dore = LinearSegmentedColormap.from_list('pain_dore', ['#F5E6D3', '#F4D9A6', '#E8B870', '#D4974B', '#B87333', '#8B4513'])
5
+
6
+ # baguette bien cuite (du clair au foncé)
7
+ baguette_bien_cuite = LinearSegmentedColormap.from_list('baguette_bien_cuite', ['#FFF5E1', '#FAD6A5', '#E8B870', '#C68642', '#8B4513', '#5C3317'])
8
+
9
+ # escargot sauce persil (maron gris-vert)
10
+ escargot_persil = LinearSegmentedColormap.from_list('escargot_persil', ['#8B7355', '#A0826D', '#6B8E23', '#556B2F'])
11
+
12
+ # french kiss (rouge passionnel)
13
+ french_kiss = LinearSegmentedColormap.from_list('french_kiss', ['#FFB6C1', '#FF69B4', '#FF1493', '#C71585', '#8B0000'])
14
+
15
+ # je m'en fous (gris perle élégant)
16
+ je_m_en_fous = LinearSegmentedColormap.from_list('je_m_en_fous', ['#F0F0F0', '#D3D3D3', '#A9A9A9', '#808080', '#505050'])
17
+
18
+ # croissant beuréé (or brillant et miel)
19
+ croissant_beurre = LinearSegmentedColormap.from_list('croissant_beurre', ['#FFF8DC', '#FFD700', '#FFA500', '#FF8C00', '#DAA520'])
20
+
21
+ # Tricolore (drapeau français)
22
+ tricolore = LinearSegmentedColormap.from_list('tricolore', ['#0055A4', '#FFFFFF', '#EF4135'])
23
+
24
+ # Lavande de Provence
25
+ lavande = LinearSegmentedColormap.from_list('lavande', ['#E6E6FA', '#9B88C4', '#7B68EE', '#6A5ACD', '#483D8B'])
26
+
27
+ # Bordeaux (vin rouge)
28
+ bordeaux = LinearSegmentedColormap.from_list('bordeaux', ['#FFF5F5', '#FFB6C1', '#DC143C', '#8B0000', '#4B0000'])
29
+
30
+ # Champagne (pétillant et doré)
31
+ champagne = LinearSegmentedColormap.from_list('champagne', ['#F0F0E8', '#F5DEB3', '#FFD700', '#DAA520', '#B8860B'])
32
+
33
+ # Fromage (palette des fromages français)
34
+ fromage = LinearSegmentedColormap.from_list('fromage', ['#FFFEF0', '#FFF8DC', '#F5DEB3', '#EAD5A8', '#D4AF37'])
35
+
36
+ # Côte d'Azur (mer et ciel)
37
+ cote_azur = LinearSegmentedColormap.from_list('cote_azur', ['#001F3F', '#0074D9', '#7FDBFF', '#39CCCC', '#3D9970'])
38
+
39
+ # Automne en Bourgogne
40
+ bourgogne = LinearSegmentedColormap.from_list('bourgogne', ['#8B4513', '#A0522D', '#CD853F', '#DEB887', '#F4A460', '#FFD700'])
41
+
42
+ # Macaron parisien (pastel gourmand)
43
+ macaron = ListedColormap(['#FFE4E1', '#FFB6C1', '#DDA0DD', '#B0E0E6', '#98FB98', '#FFFFE0'], name='macaron')
44
+
45
+ # Versailles (or et royal)
46
+ versailles = LinearSegmentedColormap.from_list('versailles', ['#FFF8DC', '#FFD700', '#DAA520', '#B8860B', '#8B7355', '#654321'])
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: frenchplotlib
3
+ Version: 0.1.0
4
+ Summary: French-themed matplotlib markers and colormaps
5
+ Home-page: https://github.com/PhilZPhaZ/frenchplotlib
6
+ Author: philzphaz
7
+ Requires-Python: >=3.6
8
+ Requires-Dist: matplotlib
9
+ Requires-Dist: numpy
10
+ Dynamic: author
11
+ Dynamic: home-page
12
+ Dynamic: requires-python
@@ -0,0 +1,27 @@
1
+ frenchplotlib/__init__.py,sha256=SwuEkVMNHilbBhdUEyKyxvTJ-0qQO88BkGGj7HMMcUs,501
2
+ frenchplotlib/baguetteplot.py,sha256=J9yDVY2848_VnVBlIU66ktdbQ_FBRjkJTAbSBcB738c,1054212
3
+ frenchplotlib/converter.py,sha256=j3THVee5VrkVnYBCs4OKTe9crxsrpx7ffnmgo4FesP8,3864
4
+ frenchplotlib/dorures.py,sha256=lbRc5IW_388PlF8F5pfkO8SKxHQjO-Yn3FYCltvUfdo,2395
5
+ frenchplotlib/assets/baguette.svg,sha256=Gz8UlVlZ-tEjXcrytc4GURBu6qjj9M5NBbd4_skSGr4,2178
6
+ frenchplotlib/assets/boule.svg,sha256=tq4376UcoDMZzFc9PIiJABMQ5a2FXz41wqskl4xhRQg,7304
7
+ frenchplotlib/assets/bretzel.svg,sha256=v3fZZ5jzni05ilOu47SUjAY34hFUz8Yi9vF2GXLNOXI,5566
8
+ frenchplotlib/assets/brioche.svg,sha256=dsNuZiITTHNVMKDqAh5R3Iecb_bIpy4KsgQFg7XuHSs,6684
9
+ frenchplotlib/assets/camembert.svg,sha256=P45SpNBzxntSOsAerrYItbLL1JALQ-wv5EKVDiBMAiI,6541
10
+ frenchplotlib/assets/croissant.svg,sha256=lNRDEF19UVS0y6XLG-1NYaQxU7hGKolyo7igJJbRMgE,13025
11
+ frenchplotlib/assets/eclair.svg,sha256=cntTvovR4Yg9rZE5xgZN8Io46gzJJnQ88qwfyTXJMHw,2914
12
+ frenchplotlib/assets/escargot.svg,sha256=OZHWiqG1mAfYz0uKc0Xl_MuijYa6KR38yoFhPmPAO80,12672
13
+ frenchplotlib/assets/fougasse.svg,sha256=l5rRwoR88IXjKF3YJx3i7bFQ7zuIT_jlT071XIGqzKY,4032
14
+ frenchplotlib/assets/fromage.svg,sha256=Q8fi5YtGRz73bL9VKfuLekLkaKIr6NPJ1kbGSF1J41w,6242
15
+ frenchplotlib/assets/macaron.svg,sha256=xNsLfm0hl-zq0HeU7GCeEDD-FD_Qcjv-7tzu5hOSRN8,29488
16
+ frenchplotlib/assets/madeleine.svg,sha256=G5ifYtqtK5cvAYTeuBKL4ERl9j3liJnjW4aAEHIfBqM,11368
17
+ frenchplotlib/assets/pain_au_chocolat.svg,sha256=HH9_fUker08nA5w8j15VgwVuGSLf1YAJKc2S4EWsfBg,13648
18
+ frenchplotlib/assets/pain_de_mie.svg,sha256=c3rDRRCQQSQ7jwskuP4gr0iS8Ceh6AtfQWy1BbiGgJ8,3738
19
+ frenchplotlib/assets/pita.svg,sha256=-XdRrnsSgDH7UmpEKIWRSmeKT1R7RfCih-gK0YHRqFs,1983
20
+ frenchplotlib/assets/religieuse.svg,sha256=cUXtqA5610bz_8XT16BxPLiQEw3SYY09gKbCpSaGc4E,20587
21
+ frenchplotlib/assets/vin.svg,sha256=3BibINXh2o_e_Aso6NUfyUe4Kicor_51igwIV10lv6w,6451
22
+ frenchplotlib/assets/nous/mathis.svg,sha256=kHfrZUAh3IP2gSu0NKHGnifjXMzgh5LJsMgGhhnoSMM,69048
23
+ frenchplotlib/assets/nous/moi.svg,sha256=IIALtyrJe4boi_9Yp9GKQv7dzkbk2YtDbxX1ef106dQ,345870
24
+ frenchplotlib-0.1.0.dist-info/METADATA,sha256=-EZa5Tz1c4efV6cIyTDiVhJCY4Brzh3ol15ToZ5CM-U,315
25
+ frenchplotlib-0.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
26
+ frenchplotlib-0.1.0.dist-info/top_level.txt,sha256=oitgsanLokGFVInAGAje6_UuNo1zIm0vd-2_QsYwIp8,14
27
+ frenchplotlib-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.10.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ frenchplotlib