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.
- BioLizardStylePython/__init__.py +32 -1
- BioLizardStylePython/lizard_style.mplstyle +3 -7
- BioLizardStylePython/utils.py +236 -203
- biolizardstylepython-0.2.0.dist-info/METADATA +69 -0
- biolizardstylepython-0.2.0.dist-info/RECORD +8 -0
- {biolizardstylepython-0.1.0.dist-info → biolizardstylepython-0.2.0.dist-info}/WHEEL +1 -1
- {biolizardstylepython-0.1.0.dist-info → biolizardstylepython-0.2.0.dist-info}/licenses/LICENSE +21 -21
- biolizardstylepython-0.1.0.dist-info/METADATA +0 -15
- biolizardstylepython-0.1.0.dist-info/RECORD +0 -8
BioLizardStylePython/__init__.py
CHANGED
|
@@ -1 +1,32 @@
|
|
|
1
|
-
|
|
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:
|
|
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:
|
|
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', ['
|
|
45
|
+
axes.prop_cycle: cycler('color', ['01a086', '1e2237', 'e9b940','105144', '6CC7B7', '233E60', '666666', 'D6D6D6'])
|
|
50
46
|
|
|
51
47
|
#TICKS
|
|
52
48
|
|
BioLizardStylePython/utils.py
CHANGED
|
@@ -1,203 +1,236 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import io
|
|
3
|
-
import numpy as np
|
|
4
|
-
from PIL import Image
|
|
5
|
-
|
|
6
|
-
import matplotlib.
|
|
7
|
-
import
|
|
8
|
-
|
|
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
|
-
cmap = matplotlib.colors.
|
|
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
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
#
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
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,,
|
{biolizardstylepython-0.1.0.dist-info → biolizardstylepython-0.2.0.dist-info}/licenses/LICENSE
RENAMED
|
@@ -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,,
|