BioLizardStylePython 0.1.0__py3-none-any.whl → 0.2.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.
@@ -1 +1,32 @@
1
- from .utils import biolizard_qualitative_pal, biolizard_sequential_pal, biolizard_divergent_pal, finalise_lizardplot, lizard_style
1
+ # check if colorspace installed
2
+ try:
3
+ import colorspace
4
+ except ModuleNotFoundError:
5
+ print('Could not find colorspace module. Install with `pip install git+https://github.com/retostauffer/python-colorspace.git`')
6
+ raise
7
+
8
+ # clear matplotlib cache to make sure lato font is recognized
9
+ import matplotlib as mpl
10
+ import os, glob
11
+ for f in glob.glob(mpl.get_cachedir() + '/*'):
12
+ os.remove(f)
13
+
14
+
15
+ # # check if lato font installed and install if needed
16
+ from matplotlib import font_manager
17
+ fonts = font_manager.fontManager.ttflist
18
+ font_names = [font.name for font in fonts if 'lato' in font.name.lower()]
19
+ font_names = set(font_names)
20
+
21
+
22
+ if len(font_names) == 0:
23
+ from fonts.ttf import Lato, LatoBold
24
+ font_manager.fontManager.addfont(Lato) # adds a custom font from a file without installing it into the operating system
25
+ font_manager.fontManager.addfont(LatoBold)
26
+ prop = font_manager.FontProperties(fname=Lato)
27
+ lato_localname = prop.get_name()
28
+ else:
29
+ lato_localname = font_names.pop() #pick first one, usually there should only be one.. (?)
30
+
31
+
32
+ from .utils import *
@@ -7,7 +7,7 @@
7
7
  ## Patches are graphical objects that fill 2D space, like polygons or circles.
8
8
 
9
9
  patch.linewidth: 0 # edge width in points.
10
- patch.facecolor: 348ABD # blue
10
+ patch.facecolor: 01a086 # BLZ green
11
11
  patch.edgecolor: EEEEEE
12
12
  patch.antialiased: True # render patches in antialiased (no jaggies)
13
13
 
@@ -15,7 +15,7 @@ patch.antialiased: True # render patches in antialiased (no jaggies)
15
15
  ## * FONT *
16
16
  ## ***************************************************************************
17
17
  font.family: sans-serif
18
- font.sans-serif: Avenir LT Std
18
+ font.sans-serif: Lato
19
19
  font.size: 14
20
20
 
21
21
  ## ***************************************************************************
@@ -41,12 +41,8 @@ axes.spines.right: False #Axis line at right of plot
41
41
 
42
42
 
43
43
  #Biolizard qualitative color palette (e.g. when plotting multiple lines)
44
- #Starts of with 'biolizard' dark gray -> green -> yellow, followed by other colors in palette
45
- #This palette is inspired by Martin Krzywinski's "12-COLOR PALETTE FOR COLORBLINESS"
46
- #and is infused with the signature house colors of Biolizard for the first three shades.
47
- #Tailored to be inclusive, it is friendly for those with the prevalent form of color blindness: Deuteranopia (Red-Green Color Blindness).
48
44
 
49
- axes.prop_cycle: cycler('color', ['1e2237', '01a086', 'e9b940','00C2F9', 'FF6E3A', '8400CD', 'FFB2FD', 'A40122','008DF9','00FCCF','E20134','FF5AAF','A40122'])
45
+ axes.prop_cycle: cycler('color', ['01a086', '1e2237', 'e9b940','105144', '6CC7B7', '233E60', '666666', 'D6D6D6'])
50
46
 
51
47
  #TICKS
52
48
 
@@ -1,203 +1,236 @@
1
- import os
2
- import io
3
- import numpy as np
4
- from PIL import Image
5
- import matplotlib.pyplot as plt
6
- import matplotlib.colors
7
- import colorspace
8
-
9
- def lizard_style(font_name='Nunito Sans 10pt'):
10
- """
11
- Load and apply the lizard_style for matplotlib plots.
12
-
13
- Parameters:
14
- -----------
15
- font_name : str, optional
16
- The name of the font to be used for the plots. By default, it uses 'Nunito Sans 10pt'.
17
- If you want to use your own local installation of Nunito Sans or any other font,
18
- specify the font name using this parameter. For more details on how to use
19
- the font_name parameter, refer to the 'In_Action' file on GitHub.
20
-
21
- Example:
22
- --------
23
- #>>> lizard_style(font_name='Nunito')
24
-
25
- Notes:
26
- ------
27
- Ensure that the specified font is installed on your system and is recognized by matplotlib.
28
-
29
- """
30
- style_path = os.path.join(os.path.dirname(__file__), 'lizard_style.mplstyle')
31
- plt.style.use(style_path)
32
- plt.rcParams['font.sans-serif'] = [font_name]
33
-
34
-
35
-
36
- def biolizard_qualitative_pal():
37
- """
38
- Generate a qualitative colormap for matplotlib.
39
-
40
- This colormap is inspired by Martin Krzywinski's "12-COLOR PALETTE FOR COLORBLINDNESS"
41
- and incorporates the signature house colors of BioLizard for the first three shades.
42
- Specifically designed to be inclusive, it is suitable for individuals with the most
43
- common form of color blindness: Deuteranopia (Red-Green Color Blindness).
44
-
45
- Returns:
46
- matplotlib.colors.ListedColormap: A colormap object suitable for use with matplotlib plots.
47
-
48
- Example:
49
- #>>> bar_colors = [biolizard_qualitative_pal(i) for i in range(len(categories))]
50
- #>>> bars = plt.bar(categories, values, color=bar_colors)
51
- #>>> plt.show()
52
- """
53
- return matplotlib.colors.ListedColormap([
54
- "#01a086", "#1e2237", "#e9b940", "#00C2F9", "#FF6E3A", "#00FCCF",
55
- "#8400CD", "#E20134", "#008DF9","#FFB2FD", "#FF5AAF", "#A40122"
56
- ])
57
-
58
- #Sequential and divergent color map
59
- #These two color maps will be registered as 'biolizard_<sequential/divergent>_pal' when installing the package.
60
-
61
- #Internal function
62
- def create_and_register_colormap(palette, name):
63
- """
64
- Create and register a colormap with matplotlib.
65
-
66
- This function generates a colormap from a given palette and registers it with
67
- matplotlib under the specified name.
68
-
69
- Parameters:
70
- - palette (function): A function that returns a list of colors.
71
- - name (str): The name under which the colormap will be registered with matplotlib.
72
-
73
- Example:
74
- #>>> biolizard_sequential_pal = colorspace.sequential_hcl(h=170, c=[40,0,75], l=[35,90], power=1)
75
- #>>> create_and_register_colormap(biolizard_sequential_pal, "biolizard_sequential_pal")
76
- """
77
- colors = palette(256)
78
- rgbcolors = [matplotlib.colors.to_rgb(color) for color in colors]
79
- cmap = matplotlib.colors.LinearSegmentedColormap.from_list(name, rgbcolors)
80
- if name == "biolizard_sequential_pal":
81
- cmap = cmap.reversed() # Reverse the order of the colors
82
- matplotlib.colormaps.register(name=name, cmap=cmap)
83
-
84
- # Sequential Biolizard Color Map
85
- #
86
- # This colormap applies the sequential Biolizard palette.
87
- #
88
- # Details:
89
- # The sequential palette represents underlying values using a consistent sequence of increasing luminance.
90
- # The hue is derived from the Biolizard green. The palette utilizes gradients within the HCL-spectrum for perceptual uniformity.
91
- # The chroma follows a triangular progression to help differentiate the middle range values from the extreme values.
92
- biolizard_sequential_pal = colorspace.sequential_hcl(h=170, c=[40,0,75], l=[35,90], power=1)
93
- create_and_register_colormap(biolizard_sequential_pal, "biolizard_sequential_pal")
94
-
95
- # Divergent Biolizard Color Map
96
- #
97
- # This colormap applies the divergent Biolizard palette for scenarios where color corresponds to categories with a natural midpoint.
98
- #
99
- # Details:
100
- # This divergent palette codes underlying numeric values by a triangular luminance sequence with different hues
101
- # in the left and in the right "arms" of the palette. Specifically:
102
- # (a) a single hue is used for each arm of the palette,
103
- # (b) chroma and luminance trajectory are balanced between the two arms,
104
- # (c) the neutral central value has zero chroma.
105
- # The palette is crafted using hue 291 and hue 170, which is the distinctive biolizard green.
106
- # This unique hue pairing produces a palette that remains accessible for all major forms of color blindness.
107
- biolizard_divergent_pal = colorspace.diverging_hcl(h=[291, 170], c=80, l=[35, 95], power=1)
108
- create_and_register_colormap(biolizard_divergent_pal, "biolizard_divergent_pal")
109
-
110
- def finalise_lizardplot(plot, source_text, fontsize=12, pdf=False, output_name="TempLizardPlot", save_filepath=None):
111
- """
112
- Finalise and save a plot with custom adjustments and a source text.
113
-
114
- This function takes a provided plot, adjusts its layout, and appends a footer
115
- at the bottom containing a source text and a logo. The combined image is then saved
116
- either as a PNG or a PDF.
117
-
118
- Parameters:
119
- - plot (matplotlib.figure.Figure): The input plot to be finalized.
120
- - source_text (str): The source text to be displayed at the bottom of the plot.
121
- - fontsize (int, optional): Font size of the source text. Defaults to 12.
122
- - pdf (bool, optional): If True, saves the output as a PDF. Otherwise, saves as a PNG. Defaults to False.
123
- - output_name (str, optional): Name of the output file (without extension). Defaults to "TempLizardPlot".
124
- - save_filepath (str, optional): Full path to save the output (with extension). If specified, it takes precedence over output_name.
125
-
126
- Returns:
127
- None. The combined image is saved to the specified location or the current working directory.
128
-
129
- Example:
130
- #>>> fig, ax = plt.subplots()
131
- #>>> ax.plot([0, 1], [0, 1])
132
- #>>> finalise_lizardplot(fig, "Source: BioLizard Data", pdf=True)
133
- """
134
- # Adjust the provided plot
135
- plot.subplots_adjust(left=0.11, bottom=0.13, right=0.95)
136
-
137
- # Save the adjusted plot to a temporary buffer
138
- buf = io.BytesIO()
139
- dpi = 300 # Increased DPI for higher resolution
140
- plot.savefig(buf, format='png', pad_inches=0.1, dpi=dpi)
141
- buf.seek(0)
142
- img2 = Image.open(buf)
143
-
144
- # Get the width of the saved plot in pixels
145
- swarmplot_width, _ = img2.size
146
-
147
- # Adjust the width and height of the custom figure to match the width of the plot in pixels
148
- custom_fig_width_inches = swarmplot_width / dpi
149
- custom_fig_height_inches = 0.4 # Reduced height
150
-
151
- fig1 = plt.figure(figsize=(custom_fig_width_inches, custom_fig_height_inches))
152
- ax = fig1.add_axes([0, 0, 1, 1])
153
- ax.plot([0, 1], [1, 1], color='black', linewidth=1.5, transform=ax.transAxes)
154
-
155
- font_name = plt.rcParams['font.sans-serif'][0]
156
-
157
- ax.text(0.05, 0.5, source_text, verticalalignment='center', transform=ax.transAxes, fontsize=fontsize,
158
- fontname=font_name)
159
-
160
- ax_image = fig1.add_axes([0.90, -0.09, 0.10, 1], anchor='NE', zorder=-1)
161
-
162
- # Get the directory of the current script
163
- current_directory = os.path.dirname(os.path.abspath(__file__))
164
- # Construct the path to the image
165
- image_path = os.path.join(current_directory, 'logo', 'BiolizardLogo.png')
166
- # Read the image
167
- img = plt.imread(image_path)
168
-
169
- ax_image.imshow(img)
170
- ax_image.axis('off')
171
- ax.axis('off')
172
-
173
- # Save the custom figure to a temporary buffer
174
- buf1 = io.BytesIO()
175
- fig1.savefig(buf1, format='png', pad_inches=0.1, dpi=dpi)
176
- buf1.seek(0)
177
- img1 = Image.open(buf1)
178
- plt.close(fig1)
179
-
180
- # Concatenate the two images vertically
181
- combined_img = Image.new('RGB', (swarmplot_width, img1.height + img2.height))
182
- combined_img.paste(img2, (0, 0))
183
- combined_img.paste(img1, (0, img2.height))
184
-
185
- # Save the concatenated image
186
- if pdf:
187
- if save_filepath:
188
- filename = save_filepath
189
- else:
190
- filename = output_name + '.pdf'
191
- combined_img.save(filename, "PDF", resolution=100.0)
192
- else:
193
- if save_filepath:
194
- filename = save_filepath
195
- else:
196
- filename = output_name + '.png'
197
- combined_img.save(filename)
198
-
199
-
200
-
201
-
202
-
203
-
1
+ import os
2
+ import io
3
+ # import numpy as np
4
+ from PIL import Image
5
+ from pathlib import Path
6
+ import matplotlib.pyplot as plt
7
+ import matplotlib.colors
8
+ from matplotlib import font_manager
9
+ import colorspace
10
+
11
+ # the three basic colors
12
+ blz_green = "#01a086"
13
+ blz_blue = "#1e2237"
14
+ blz_yellow = "#e9b940"
15
+
16
+
17
+ def lizard_style():
18
+ """
19
+ Load and apply the lizard_style for matplotlib plots.
20
+
21
+ Parameters:
22
+ -----------
23
+ font_name : str, optional
24
+ The name of the font to be used for the plots. By default, it uses 'Lato'.
25
+ If you want to use your own local installation of Lato or any other font,
26
+ specify the font name using this parameter. For more details on how to use
27
+ the font_name parameter, refer to the 'In_Action' file on GitHub.
28
+
29
+ Example:
30
+ --------
31
+ #>>> lizard_style()
32
+
33
+ Notes:
34
+ ------
35
+ Ensure that the specified font is installed on your system and is recognized by matplotlib.
36
+
37
+ """
38
+ style_path = os.path.join(os.path.dirname(__file__), 'lizard_style.mplstyle')
39
+ plt.style.use(style_path)
40
+ from BioLizardStylePython import lato_localname
41
+ plt.rcParams['font.sans-serif'] = [lato_localname]
42
+
43
+
44
+ def biolizard_qualitative_pal():
45
+ """
46
+ Generate a qualitative colormap for matplotlib.
47
+
48
+ Specifically designed to be inclusive, it is suitable for individuals with the most
49
+ common form of color blindness: Deuteranopia (Red-Green Color Blindness).
50
+
51
+ Returns:
52
+ matplotlib.colors.ListedColormap: A colormap object suitable for use with matplotlib plots.
53
+
54
+ Example:
55
+ #>>> bar_colors = [biolizard_qualitative_pal(i) for i in range(len(categories))]
56
+ #>>> bars = plt.bar(categories, values, color=bar_colors)
57
+ #>>> plt.show()
58
+ """
59
+ return matplotlib.colors.ListedColormap([
60
+ "#01a086", "#1e2237", "#e9b940","#105144",
61
+ "#6CC7B7", "#233E60", "#666666", "#D6D6D6"
62
+ ])
63
+
64
+ def biolizard_qualitative_pal_r():
65
+ """
66
+ Generate a qualitative colormap for matplotlib. Colors are reversed compared to biolizard_qualitative_pal.
67
+
68
+ Specifically designed to be inclusive, it is suitable for individuals with the most
69
+ common form of color blindness: Deuteranopia (Red-Green Color Blindness).
70
+
71
+ Returns:
72
+ matplotlib.colors.ListedColormap: A colormap object suitable for use with matplotlib plots.
73
+
74
+ Example:
75
+ #>>> bar_colors = [biolizard_qualitative_pal(i) for i in range(len(categories))]
76
+ #>>> bars = plt.bar(categories, values, color=bar_colors)
77
+ #>>> plt.show()
78
+ """
79
+ cmap = matplotlib.colors.ListedColormap([
80
+ "#01a086", "#1e2237", "#e9b940","#105144",
81
+ "#6CC7B7", "#233E60", "#666666", "#D6D6D6"
82
+ ])
83
+
84
+ return cmap.reversed()
85
+
86
+ #Sequential and divergent color map
87
+ #These two color maps will be registered as 'biolizard_<sequential/divergent>_pal' when installing the package.
88
+
89
+ #Internal function
90
+ def _create_and_register_colormap(palette, name, reverse=False):
91
+ """
92
+ Create and register a colormap with matplotlib.
93
+
94
+ This function generates a colormap from a given palette and registers it with
95
+ matplotlib under the specified name.
96
+
97
+ Parameters:
98
+ - palette (function): A function that returns a list of colors.
99
+ - name (str): The name under which the colormap will be registered with matplotlib.
100
+
101
+ Example:
102
+ #>>> biolizard_sequential_pal = colorspace.sequential_hcl(h=170, c=[40,0,75], l=[35,90], power=1)
103
+ #>>> create_and_register_colormap(biolizard_sequential_pal, "biolizard_sequential_pal")
104
+ """
105
+ colors = palette(256)
106
+ rgbcolors = [matplotlib.colors.to_rgb(color) for color in colors]
107
+ cmap = matplotlib.colors.LinearSegmentedColormap.from_list(name, rgbcolors)
108
+ if reverse:
109
+ cmap = cmap.reversed()
110
+ matplotlib.colormaps.register(name=name, cmap=cmap)
111
+
112
+
113
+ # Sequential Biolizard Color Map
114
+ #
115
+ # This colormap applies the sequential Biolizard palette.
116
+ #
117
+ # Details:
118
+ # The sequential palette represents underlying values using a consistent sequence of increasing luminance.
119
+ # The hue is derived from the Biolizard green. The palette utilizes gradients within the HCL-spectrum for perceptual uniformity.
120
+ # The chroma follows a triangular progression to help differentiate the middle range values from the extreme values.
121
+ biolizard_sequential_pal = colorspace.sequential_hcl(h=170, c=[0,75,40], l=[90,35], power=1)
122
+ _create_and_register_colormap(biolizard_sequential_pal, "biolizard_sequential_pal")
123
+ _create_and_register_colormap(biolizard_sequential_pal, "biolizard_sequential_pal_r", reverse=True)
124
+
125
+
126
+ # Divergent Biolizard Color Map
127
+ #
128
+ # This colormap applies the divergent Biolizard palette for scenarios where color corresponds to categories with a natural midpoint.
129
+ #
130
+ # Details:
131
+ # This divergent palette codes underlying numeric values by a triangular luminance sequence with different hues
132
+ # in the left and in the right "arms" of the palette. Specifically:
133
+ # (a) a single hue is used for each arm of the palette,
134
+ # (b) chroma and luminance trajectory are balanced between the two arms,
135
+ # (c) the neutral central value has zero chroma.
136
+ # The palette is crafted using hue 291 and hue 170, which is the distinctive biolizard green.
137
+ # This unique hue pairing produces a palette that remains accessible for all major forms of color blindness.
138
+ biolizard_divergent_pal = colorspace.diverging_hcl(h=[60, 170], c=80, l=[50, 95], power=1)
139
+ _create_and_register_colormap(biolizard_divergent_pal, "biolizard_divergent_pal")
140
+ _create_and_register_colormap(biolizard_divergent_pal, "biolizard_divergent_pal_r", reverse=True)
141
+
142
+
143
+ def finalise_lizardplot(plot, source_text, fontsize=12, pdf=False, output_name="TempLizardPlot", save_filepath=None):
144
+ """
145
+ Finalise and save a plot with custom adjustments and a source text.
146
+
147
+ This function takes a provided plot, adjusts its layout, and appends a footer
148
+ at the bottom containing a source text and a logo. The combined image is then saved
149
+ either as a PNG or a PDF.
150
+
151
+ Parameters:
152
+ - plot (matplotlib.figure.Figure): The input plot to be finalized.
153
+ - source_text (str): The source text to be displayed at the bottom of the plot.
154
+ - fontsize (int, optional): Font size of the source text. Defaults to 12.
155
+ - pdf (bool, optional): If True, saves the output as a PDF. Otherwise, saves as a PNG. Defaults to False.
156
+ - output_name (str, optional): Name of the output file (without extension). Defaults to "TempLizardPlot".
157
+ - save_filepath (str, optional): Full path to save the output (with extension). If specified, it takes precedence over output_name.
158
+
159
+ Returns:
160
+ None. The combined image is saved to the specified location or the current working directory.
161
+
162
+ Example:
163
+ #>>> fig, ax = plt.subplots()
164
+ #>>> ax.plot([0, 1], [0, 1])
165
+ #>>> finalise_lizardplot(fig, "Source: BioLizard Data", pdf=True)
166
+ """
167
+ # Adjust the provided plot
168
+ plot.subplots_adjust(left=0.11, bottom=0.13, right=0.95)
169
+
170
+ # Save the adjusted plot to a temporary buffer
171
+ buf = io.BytesIO()
172
+ dpi = 300 # Increased DPI for higher resolution
173
+ plot.savefig(buf, format='png', pad_inches=0.1, dpi=dpi)
174
+ buf.seek(0)
175
+ img2 = Image.open(buf)
176
+
177
+ # Get the width of the saved plot in pixels
178
+ swarmplot_width, _ = img2.size
179
+
180
+ # Adjust the width and height of the custom figure to match the width of the plot in pixels
181
+ custom_fig_width_inches = swarmplot_width / dpi
182
+ custom_fig_height_inches = 0.4 # Reduced height
183
+
184
+ fig1 = plt.figure(figsize=(custom_fig_width_inches, custom_fig_height_inches))
185
+ ax = fig1.add_axes([0, 0, 1, 1])
186
+ ax.plot([0, 1], [1, 1], color='black', linewidth=1.5, transform=ax.transAxes)
187
+
188
+ font_name = plt.rcParams['font.sans-serif'][0]
189
+
190
+ ax.text(0.05, 0.5, source_text, verticalalignment='center', transform=ax.transAxes, fontsize=fontsize,
191
+ fontname=font_name)
192
+
193
+ ax_image = fig1.add_axes([0.90, -0.09, 0.10, 1], anchor='NE', zorder=-1)
194
+
195
+ # Get the directory of the current script
196
+ current_directory = os.path.dirname(os.path.abspath(__file__))
197
+ # Construct the path to the image
198
+ image_path = os.path.join(current_directory, 'logo', 'BiolizardLogo.png')
199
+ # Read the image
200
+ img = plt.imread(image_path)
201
+
202
+ ax_image.imshow(img)
203
+ ax_image.axis('off')
204
+ ax.axis('off')
205
+
206
+ # Save the custom figure to a temporary buffer
207
+ buf1 = io.BytesIO()
208
+ fig1.savefig(buf1, format='png', pad_inches=0.1, dpi=dpi)
209
+ buf1.seek(0)
210
+ img1 = Image.open(buf1)
211
+ plt.close(fig1)
212
+
213
+ # Concatenate the two images vertically
214
+ combined_img = Image.new('RGB', (swarmplot_width, img1.height + img2.height))
215
+ combined_img.paste(img2, (0, 0))
216
+ combined_img.paste(img1, (0, img2.height))
217
+
218
+ # Save the concatenated image
219
+ if pdf:
220
+ if save_filepath:
221
+ filename = save_filepath
222
+ else:
223
+ filename = output_name + '.pdf'
224
+ combined_img.save(filename, "PDF", resolution=100.0)
225
+ else:
226
+ if save_filepath:
227
+ filename = save_filepath
228
+ else:
229
+ filename = output_name + '.png'
230
+ combined_img.save(filename)
231
+
232
+
233
+
234
+
235
+
236
+
@@ -0,0 +1,69 @@
1
+ Metadata-Version: 2.3
2
+ Name: BioLizardStylePython
3
+ Version: 0.2.0
4
+ Summary: Enhance plots with the signature Biolizard aesthetic for matplotlib and seaborn.
5
+ Project-URL: Homepage, https://github.com/lizard-bio/nature-grade-visualization-playground/tree/main
6
+ Author: Robbe Neirynck
7
+ Author-email: BioLizard <contact@lizard.bio>, Aniko Meijer <aniko.meijer@lizard.bio>
8
+ Maintainer-email: Alexander Koch <alexander.koch@lizard.bio>, Aniko Meijer <aniko.meijer@lizard.bio>
9
+ License-File: LICENSE
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.9
14
+ Requires-Dist: font-lato>=0.0.1
15
+ Requires-Dist: fonts>=0.0.3
16
+ Requires-Dist: matplotlib>=3.7.1
17
+ Requires-Dist: pillow>=9.4.0
18
+ Description-Content-Type: text/markdown
19
+
20
+ # BioLizardStylePython
21
+
22
+ Enhance plots with the signature Biolizard aesthetic for matplotlib and seaborn.
23
+
24
+ ## install
25
+
26
+ ### 1. Extra requirements
27
+ `BioLizardStylePython` relies on the colorspace package, which is not available on the Python Package Index (PyPI). However, it is hosted on GitHub and needs to be installed directly from there. To install the `colorspace` package, please run the following command in your terminal:
28
+ ```
29
+ pip install git+https://github.com/retostauffer/python-colorspace.git
30
+ ```
31
+ Once you've successfully installed `colorspace`, you can proceed with the installation and usage of `BioLizardStylePython`.
32
+
33
+ ### 2. Package Installation
34
+
35
+ The BioLizardStylePython package is available on PyPI and can be easily installed using:
36
+ ```
37
+ pip install BioLizardStylePython
38
+ ```
39
+
40
+ ### 3. Font Installation
41
+
42
+ The BioLizardStyleR package makes use of the signature BioLizard font 'Lato'. This font can be found on Google Fonts under an open font license.
43
+
44
+ If you don't have the Lato font locally installed, you can download and install it from GitHub.
45
+
46
+ 1. **Download Fonts**: Download the two font files from the GitHub repository [Nature Grade Visualization Playground](https://github.com/lizard-bio/nature-grade-visualization-playground/tree/main).
47
+ 2. **Install Fonts**: Install the downloaded fonts on your system.
48
+ 3. **Complete**: Once the installation is done, you're all set to use the font.
49
+
50
+ ## usage
51
+
52
+ ### 1. Styling Function: `lizard_style()`
53
+
54
+ This function applies a BioLizard aesthetic to your matplotlib or seaborn plots. The aim is to ensure that plots maintain a uniform look, irrespective of whether they were made in R or Python.
55
+
56
+ ### 2. BioLizard Color Palettes
57
+
58
+ These are qualitative, sequential, and divergent color maps that can be applied to your plots. The palettes are designed using BioLizard's house colors, keeping perceptual uniformity and color-blind friendliness in mind. For more information, consult the help documentation specific to each function.
59
+
60
+ ### 3. Finalizing and Exporting Plots: `finalise_lizardplot()`
61
+
62
+ This function adds a BioLizard footer beneath your graph and exports it to a specified format such as PNG or PDF. The footer includes the BioLizard logo at the bottom right corner and leaves room for source text.
63
+
64
+ ## Contributing and Feedback
65
+
66
+ Contributions and feedback are very welcome and much appreciated.
67
+
68
+ Issues can be reported [on github](https://github.com/lizard-bio/nature-grade-visualization-playground/issues).
69
+
@@ -0,0 +1,8 @@
1
+ BioLizardStylePython/__init__.py,sha256=ZO7h1NIHXDVUFB_er0Pu-12HlQ6VlKm631TKe5Y1YvI,1086
2
+ BioLizardStylePython/lizard_style.mplstyle,sha256=i8FO4EhYVRxC7019oErPc47ohWOsauIbfzgaPeIitGU,2328
3
+ BioLizardStylePython/utils.py,sha256=DTR_b5EJ-WlO2x3ttH1BydSLByb8CPC0WOE-4PGVKm0,9065
4
+ BioLizardStylePython/logo/BiolizardLogo.png,sha256=DzWR2GMShARwLflS6KG7iXfULPRtLFvD1TbiNpKvuy0,18462
5
+ biolizardstylepython-0.2.0.dist-info/METADATA,sha256=dHqbjdTVPvDmnPfdCzvNNzDKdXqvAXKFNhzjyIkmPvM,3294
6
+ biolizardstylepython-0.2.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
7
+ biolizardstylepython-0.2.0.dist-info/licenses/LICENSE,sha256=37SFUF7Rozb7qKppNSQ8fQbC2DYq9TSX0EqpvQ1iQLg,1071
8
+ biolizardstylepython-0.2.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.18.0
2
+ Generator: hatchling 1.24.2
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,22 +1,22 @@
1
- Copyright (c) 2023 BioLizard
2
-
3
- Permission is hereby granted, free of charge, to any person
4
- obtaining a copy of this software and associated documentation
5
- files (the "Software"), to deal in the Software without
6
- restriction, including without limitation the rights to use,
7
- copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the
9
- Software is furnished to do so, subject to the following
10
- conditions:
11
-
12
- The above copyright notice and this permission notice shall be
13
- included in all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1
+ Copyright (c) 2023 BioLizard
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
22
  OTHER DEALINGS IN THE SOFTWARE.
@@ -1,15 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: BioLizardStylePython
3
- Version: 0.1.0
4
- Summary: Enhance plots with the signature Biolizard aesthetic for matplotlib and seaborn.
5
- Project-URL: Homepage, https://github.com/lizard-bio/nature-grade-visualization-playground/tree/main
6
- Author: BioLizard
7
- Author-email: Robbe Neirynck <robbe.neirynck1@hotmail.com>
8
- License-File: LICENSE
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
- Classifier: Programming Language :: Python :: 3
12
- Requires-Python: >=3.9
13
- Requires-Dist: matplotlib>=3.7.1
14
- Requires-Dist: numpy>=1.24.30
15
- Requires-Dist: pillow>=9.4.0
@@ -1,8 +0,0 @@
1
- BioLizardStylePython/__init__.py,sha256=BZABvXp3EryXGh8Ckmdc0zVQ9zOtHU6xRDffZ3HBJAU,132
2
- BioLizardStylePython/lizard_style.mplstyle,sha256=RK8sR3xQgJRwPK2JYxFBBBIw7VDy81YYLlq6-_HRnUQ,2783
3
- BioLizardStylePython/utils.py,sha256=diQqu10Wbgi4BPJUQD6mng3uuNxfbBokSECOJZPaBA8,8368
4
- BioLizardStylePython/logo/BiolizardLogo.png,sha256=DzWR2GMShARwLflS6KG7iXfULPRtLFvD1TbiNpKvuy0,18462
5
- biolizardstylepython-0.1.0.dist-info/METADATA,sha256=U-fPo0uHeJA2tBf8onYvmoayYSLAPIwaKQO9sMuEAo0,615
6
- biolizardstylepython-0.1.0.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87
7
- biolizardstylepython-0.1.0.dist-info/licenses/LICENSE,sha256=Q6hgyTsBVFTsj79Qga5GjZL3ybkx6pHjjM3VGb-FD_I,1092
8
- biolizardstylepython-0.1.0.dist-info/RECORD,,