marsilea 0.3.5__py3-none-any.whl → 0.3.6__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.
- marsilea/__init__.py +10 -5
- marsilea/base.py +78 -51
- marsilea/plotter/__init__.py +1 -0
- marsilea/plotter/_images.py +7 -5
- marsilea/plotter/_seaborn.py +4 -2
- marsilea/plotter/arc.py +4 -2
- marsilea/plotter/area.py +18 -9
- marsilea/plotter/bar.py +3 -0
- marsilea/plotter/base.py +25 -6
- marsilea/plotter/mesh.py +24 -2
- marsilea/upset.py +12 -2
- {marsilea-0.3.5.dist-info → marsilea-0.3.6.dist-info}/METADATA +2 -2
- marsilea-0.3.6.dist-info/RECORD +27 -0
- marsilea-0.3.5.dist-info/RECORD +0 -27
- {marsilea-0.3.5.dist-info → marsilea-0.3.6.dist-info}/LICENSE +0 -0
- {marsilea-0.3.5.dist-info → marsilea-0.3.6.dist-info}/WHEEL +0 -0
marsilea/__init__.py
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Declarative creation of composable visualization"""
|
|
2
2
|
|
|
3
|
-
__version__ = "0.3.
|
|
3
|
+
__version__ = "0.3.6"
|
|
4
4
|
|
|
5
5
|
import marsilea.plotter as plotter
|
|
6
6
|
from ._deform import Deformation
|
|
7
|
-
from .base import (
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
from .base import (
|
|
8
|
+
WhiteBoard,
|
|
9
|
+
ClusterBoard,
|
|
10
|
+
ZeroWidth,
|
|
11
|
+
ZeroHeight,
|
|
12
|
+
ZeroWidthCluster,
|
|
13
|
+
ZeroHeightCluster,
|
|
14
|
+
)
|
|
10
15
|
from .dataset import load_data
|
|
11
16
|
from .dendrogram import Dendrogram, GroupDendrogram
|
|
12
17
|
from .heatmap import Heatmap, SizedHeatmap, CatHeatmap
|
marsilea/base.py
CHANGED
|
@@ -46,6 +46,7 @@ def get_breakpoints(arr):
|
|
|
46
46
|
|
|
47
47
|
class LegendMaker:
|
|
48
48
|
"""The factory class to handle legends"""
|
|
49
|
+
|
|
49
50
|
layout: CrossLayout | CompositeCrossLayout
|
|
50
51
|
_legend_box: List[Artist] = None
|
|
51
52
|
_legend_name: str = None
|
|
@@ -83,17 +84,17 @@ class LegendMaker:
|
|
|
83
84
|
self._user_legends[name] = [legend]
|
|
84
85
|
|
|
85
86
|
def add_legends(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
87
|
+
self,
|
|
88
|
+
side="right",
|
|
89
|
+
pad=0.0,
|
|
90
|
+
order=None,
|
|
91
|
+
stack_by=None,
|
|
92
|
+
stack_size=3,
|
|
93
|
+
align_legends=None,
|
|
94
|
+
align_stacks=None,
|
|
95
|
+
legend_spacing=10,
|
|
96
|
+
stack_spacing=10,
|
|
97
|
+
box_padding=2,
|
|
97
98
|
):
|
|
98
99
|
"""Draw legend based on the order of annotation
|
|
99
100
|
|
|
@@ -128,6 +129,10 @@ class LegendMaker:
|
|
|
128
129
|
Add pad around the whole legend box
|
|
129
130
|
|
|
130
131
|
"""
|
|
132
|
+
# TODO: Allow user to control where to add legends,
|
|
133
|
+
# relative to the main canvas or the whole figure
|
|
134
|
+
# TODO: Allow user to add stack_size as a list
|
|
135
|
+
# Each stack can contain different number of legends
|
|
131
136
|
_check_side(side)
|
|
132
137
|
self._draw_legend = True
|
|
133
138
|
if stack_by is None:
|
|
@@ -236,9 +241,9 @@ class WhiteBoard(LegendMaker):
|
|
|
236
241
|
|
|
237
242
|
Parameters
|
|
238
243
|
----------
|
|
239
|
-
width :
|
|
244
|
+
width : float, optional
|
|
240
245
|
The width of the main canvas in inches
|
|
241
|
-
height :
|
|
246
|
+
height : float, optional
|
|
242
247
|
The height of the main canvas in inches
|
|
243
248
|
name : str, optional
|
|
244
249
|
The name of the main canvas
|
|
@@ -305,7 +310,7 @@ class WhiteBoard(LegendMaker):
|
|
|
305
310
|
super().__init__()
|
|
306
311
|
|
|
307
312
|
def add_plot(
|
|
308
|
-
|
|
313
|
+
self, side, plot: RenderPlan, name=None, size=None, pad=0.0, legend=True
|
|
309
314
|
):
|
|
310
315
|
"""Add a plotter to the board
|
|
311
316
|
|
|
@@ -676,8 +681,9 @@ class ZeroWidth(WhiteBoard):
|
|
|
676
681
|
"""
|
|
677
682
|
|
|
678
683
|
def __init__(self, height, name=None, margin=0.2):
|
|
679
|
-
super().__init__(
|
|
680
|
-
|
|
684
|
+
super().__init__(
|
|
685
|
+
width=0, height=height, name=name, margin=margin, init_main=False
|
|
686
|
+
)
|
|
681
687
|
|
|
682
688
|
|
|
683
689
|
class ZeroHeight(WhiteBoard):
|
|
@@ -689,8 +695,9 @@ class ZeroHeight(WhiteBoard):
|
|
|
689
695
|
"""
|
|
690
696
|
|
|
691
697
|
def __init__(self, width, name=None, margin=0.2):
|
|
692
|
-
super().__init__(
|
|
693
|
-
|
|
698
|
+
super().__init__(
|
|
699
|
+
width=width, height=0, name=name, margin=margin, init_main=False
|
|
700
|
+
)
|
|
694
701
|
|
|
695
702
|
|
|
696
703
|
class CompositeBoard(LegendMaker):
|
|
@@ -771,9 +778,9 @@ class ClusterBoard(WhiteBoard):
|
|
|
771
778
|
----------
|
|
772
779
|
cluster_data : ndarray
|
|
773
780
|
The cluster data
|
|
774
|
-
width :
|
|
781
|
+
width : float, optional
|
|
775
782
|
The width of the main canvas in inches
|
|
776
|
-
height :
|
|
783
|
+
height : float, optional
|
|
777
784
|
The height of the main canvas in inches
|
|
778
785
|
name : str, optional
|
|
779
786
|
The name of the main canvas
|
|
@@ -799,13 +806,13 @@ class ClusterBoard(WhiteBoard):
|
|
|
799
806
|
_mesh = None
|
|
800
807
|
|
|
801
808
|
def __init__(
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
+
self,
|
|
810
|
+
cluster_data,
|
|
811
|
+
width=None,
|
|
812
|
+
height=None,
|
|
813
|
+
name=None,
|
|
814
|
+
margin=0.2,
|
|
815
|
+
init_main=True,
|
|
809
816
|
):
|
|
810
817
|
super().__init__(
|
|
811
818
|
width=width, height=height, name=name, margin=margin, init_main=init_main
|
|
@@ -816,24 +823,24 @@ class ClusterBoard(WhiteBoard):
|
|
|
816
823
|
self._deform = Deformation(cluster_data)
|
|
817
824
|
|
|
818
825
|
def add_dendrogram(
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
826
|
+
self,
|
|
827
|
+
side,
|
|
828
|
+
method=None,
|
|
829
|
+
metric=None,
|
|
830
|
+
linkage=None,
|
|
831
|
+
add_meta=True,
|
|
832
|
+
add_base=True,
|
|
833
|
+
add_divider=True,
|
|
834
|
+
meta_color=None,
|
|
835
|
+
linewidth=None,
|
|
836
|
+
colors=None,
|
|
837
|
+
divider_style="--",
|
|
838
|
+
meta_ratio=0.2,
|
|
839
|
+
show=True,
|
|
840
|
+
name=None,
|
|
841
|
+
size=0.5,
|
|
842
|
+
pad=0.0,
|
|
843
|
+
get_meta_center=None,
|
|
837
844
|
):
|
|
838
845
|
"""Run cluster and add dendrogram
|
|
839
846
|
|
|
@@ -1031,7 +1038,11 @@ class ClusterBoard(WhiteBoard):
|
|
|
1031
1038
|
|
|
1032
1039
|
|
|
1033
1040
|
"""
|
|
1034
|
-
warnings.warn(
|
|
1041
|
+
warnings.warn(
|
|
1042
|
+
DeprecationWarning(
|
|
1043
|
+
"`hsplit` will be deprecated in v0.5.0, use `cut_rows` or `group_rows` instead"
|
|
1044
|
+
)
|
|
1045
|
+
)
|
|
1035
1046
|
if self._split_row:
|
|
1036
1047
|
raise SplitTwice(axis="horizontally")
|
|
1037
1048
|
self._split_row = True
|
|
@@ -1094,7 +1105,11 @@ class ClusterBoard(WhiteBoard):
|
|
|
1094
1105
|
|
|
1095
1106
|
|
|
1096
1107
|
"""
|
|
1097
|
-
warnings.warn(
|
|
1108
|
+
warnings.warn(
|
|
1109
|
+
DeprecationWarning(
|
|
1110
|
+
"`vsplit` will be deprecated in v0.5.0, use `cut_cols` or `group_cols` instead"
|
|
1111
|
+
)
|
|
1112
|
+
)
|
|
1098
1113
|
if self._split_col:
|
|
1099
1114
|
raise SplitTwice(axis="vertically")
|
|
1100
1115
|
self._split_col = True
|
|
@@ -1424,8 +1439,14 @@ class ZeroWidthCluster(ClusterBoard):
|
|
|
1424
1439
|
"""
|
|
1425
1440
|
|
|
1426
1441
|
def __init__(self, cluster_data, height, name=None, margin=0.2):
|
|
1427
|
-
super().__init__(
|
|
1428
|
-
|
|
1442
|
+
super().__init__(
|
|
1443
|
+
cluster_data=cluster_data,
|
|
1444
|
+
width=0,
|
|
1445
|
+
height=height,
|
|
1446
|
+
name=name,
|
|
1447
|
+
margin=margin,
|
|
1448
|
+
init_main=False,
|
|
1449
|
+
)
|
|
1429
1450
|
|
|
1430
1451
|
|
|
1431
1452
|
class ZeroHeightCluster(ClusterBoard):
|
|
@@ -1448,5 +1469,11 @@ class ZeroHeightCluster(ClusterBoard):
|
|
|
1448
1469
|
"""
|
|
1449
1470
|
|
|
1450
1471
|
def __init__(self, cluster_data, width, name=None, margin=0.2):
|
|
1451
|
-
super().__init__(
|
|
1452
|
-
|
|
1472
|
+
super().__init__(
|
|
1473
|
+
cluster_data=cluster_data,
|
|
1474
|
+
width=width,
|
|
1475
|
+
height=0,
|
|
1476
|
+
name=name,
|
|
1477
|
+
margin=margin,
|
|
1478
|
+
init_main=False,
|
|
1479
|
+
)
|
marsilea/plotter/__init__.py
CHANGED
marsilea/plotter/_images.py
CHANGED
|
@@ -51,13 +51,11 @@ class Emoji(RenderPlan):
|
|
|
51
51
|
self.mode = mode
|
|
52
52
|
|
|
53
53
|
def _get_images_bbox(self, figure, imgs):
|
|
54
|
-
|
|
55
54
|
for img in imgs:
|
|
56
55
|
width, height = img.shape[:2]
|
|
57
56
|
|
|
58
57
|
return Bbox.from_bounds(0, 0, width, height)
|
|
59
58
|
|
|
60
|
-
|
|
61
59
|
def render_ax(self, spec):
|
|
62
60
|
ax = spec.ax
|
|
63
61
|
data = spec.data
|
|
@@ -89,9 +87,13 @@ class Emoji(RenderPlan):
|
|
|
89
87
|
x0, y0 = ax.transData.transform((loc, loc_y))
|
|
90
88
|
return Bbox.from_bounds(x0, y0, width, height)
|
|
91
89
|
|
|
92
|
-
partial_get_emoji_bbox = partial(
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
partial_get_emoji_bbox = partial(
|
|
91
|
+
get_emoji_bbox,
|
|
92
|
+
loc=loc,
|
|
93
|
+
loc_y=loc_y,
|
|
94
|
+
width=fit_scale_width,
|
|
95
|
+
height=fit_scale_height,
|
|
96
|
+
)
|
|
95
97
|
|
|
96
98
|
i1 = BboxImage(partial_get_emoji_bbox, data=img)
|
|
97
99
|
ax.add_artist(i1)
|
marsilea/plotter/_seaborn.py
CHANGED
|
@@ -20,9 +20,11 @@ class _SeabornBase(StatsBase):
|
|
|
20
20
|
hue_order=None,
|
|
21
21
|
palette=None,
|
|
22
22
|
orient=None,
|
|
23
|
-
label=None,
|
|
24
23
|
legend_kws=None,
|
|
25
24
|
group_kws=None,
|
|
25
|
+
label=None,
|
|
26
|
+
label_loc=None,
|
|
27
|
+
label_props=None,
|
|
26
28
|
**kwargs,
|
|
27
29
|
):
|
|
28
30
|
if isinstance(data, Mapping):
|
|
@@ -62,7 +64,7 @@ class _SeabornBase(StatsBase):
|
|
|
62
64
|
self.kws = kwargs
|
|
63
65
|
|
|
64
66
|
self.orient = orient
|
|
65
|
-
self.label
|
|
67
|
+
self.set_label(label, label_loc, label_props)
|
|
66
68
|
self.legend_kws = {} if legend_kws is None else legend_kws
|
|
67
69
|
if group_kws is not None:
|
|
68
70
|
self.set_group_params(group_kws)
|
marsilea/plotter/arc.py
CHANGED
|
@@ -212,8 +212,8 @@ class Arc(StatsBase):
|
|
|
212
212
|
)
|
|
213
213
|
|
|
214
214
|
if self.side == "left":
|
|
215
|
-
xy = (
|
|
216
|
-
angle = 90
|
|
215
|
+
xy = (0, arc_mid)
|
|
216
|
+
angle = -90
|
|
217
217
|
elif self.side == "right":
|
|
218
218
|
xy = (0, arc_mid)
|
|
219
219
|
angle = -90
|
|
@@ -233,6 +233,8 @@ class Arc(StatsBase):
|
|
|
233
233
|
ax.set_xlim(0, 1)
|
|
234
234
|
if self.side == "top":
|
|
235
235
|
ax.invert_yaxis()
|
|
236
|
+
if self.side == "left":
|
|
237
|
+
ax.invert_xaxis()
|
|
236
238
|
ax.set_axis_off()
|
|
237
239
|
|
|
238
240
|
def get_legends(self):
|
marsilea/plotter/area.py
CHANGED
|
@@ -42,11 +42,20 @@ class Area(StatsBase):
|
|
|
42
42
|
|
|
43
43
|
"""
|
|
44
44
|
|
|
45
|
-
def __init__(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
def __init__(
|
|
46
|
+
self,
|
|
47
|
+
data,
|
|
48
|
+
color=None,
|
|
49
|
+
add_outline=True,
|
|
50
|
+
alpha=0.4,
|
|
51
|
+
linecolor=None,
|
|
52
|
+
linewidth=1,
|
|
53
|
+
group_kws=None,
|
|
54
|
+
label=None,
|
|
55
|
+
label_loc=None,
|
|
56
|
+
label_props=None,
|
|
57
|
+
**kwargs,
|
|
58
|
+
):
|
|
50
59
|
if color is None:
|
|
51
60
|
color = "skyblue"
|
|
52
61
|
if linecolor is None:
|
|
@@ -71,22 +80,22 @@ class Area(StatsBase):
|
|
|
71
80
|
if gp is None:
|
|
72
81
|
gp = {}
|
|
73
82
|
|
|
74
|
-
fill_options = {
|
|
75
|
-
line_options = {
|
|
83
|
+
fill_options = {"color": self.color, "alpha": self.alpha, **self.kws, **gp}
|
|
84
|
+
line_options = {"color": self.linecolor, "linewidth": self.linewidth, **gp}
|
|
76
85
|
|
|
77
86
|
x = np.arange(len(data))
|
|
78
87
|
if self.get_orient() == "h":
|
|
79
88
|
ax.fill_betweenx(x, data, **fill_options)
|
|
80
89
|
if self.add_outline:
|
|
81
90
|
ax.plot(data, x, **line_options)
|
|
82
|
-
ax.set_ylim(
|
|
91
|
+
ax.set_ylim(-0.5, len(data) - 0.5)
|
|
83
92
|
if self.side == "left":
|
|
84
93
|
ax.invert_xaxis()
|
|
85
94
|
else:
|
|
86
95
|
ax.fill_between(x, data, **fill_options)
|
|
87
96
|
if self.add_outline:
|
|
88
97
|
ax.plot(x, data, **line_options)
|
|
89
|
-
ax.set_xlim(
|
|
98
|
+
ax.set_xlim(-0.5, len(data) - 0.5)
|
|
90
99
|
return ax
|
|
91
100
|
|
|
92
101
|
|
marsilea/plotter/bar.py
CHANGED
|
@@ -103,6 +103,8 @@ class Numbers(_BarBase):
|
|
|
103
103
|
show_value=True,
|
|
104
104
|
fmt=None,
|
|
105
105
|
label=None,
|
|
106
|
+
label_loc=None,
|
|
107
|
+
label_props=None,
|
|
106
108
|
value_pad=2.0,
|
|
107
109
|
props=None,
|
|
108
110
|
**kwargs,
|
|
@@ -114,6 +116,7 @@ class Numbers(_BarBase):
|
|
|
114
116
|
self._process_params(
|
|
115
117
|
width, orient, show_value, fmt, label, value_pad, props, **kwargs
|
|
116
118
|
)
|
|
119
|
+
self.set_label(label, label_loc, label_props)
|
|
117
120
|
|
|
118
121
|
def render_ax(self, spec):
|
|
119
122
|
ax = spec.ax
|
marsilea/plotter/base.py
CHANGED
|
@@ -95,6 +95,7 @@ class RenderSpec:
|
|
|
95
95
|
|
|
96
96
|
|
|
97
97
|
"""
|
|
98
|
+
|
|
98
99
|
ax: Axes
|
|
99
100
|
|
|
100
101
|
data: Any
|
|
@@ -271,11 +272,15 @@ class RenderPlan:
|
|
|
271
272
|
if group_data is not None:
|
|
272
273
|
if self.has_deform:
|
|
273
274
|
group_data = np.asarray(group_data)
|
|
274
|
-
if
|
|
275
|
+
if (
|
|
276
|
+
self.deform.is_col_split
|
|
277
|
+
& (self.is_body | (self.side == "main"))
|
|
278
|
+
& self.deform.is_col_cluster
|
|
279
|
+
):
|
|
275
280
|
return group_data[self.deform.col_chunk_index]
|
|
276
281
|
elif (
|
|
277
282
|
self.deform.is_row_split
|
|
278
|
-
& self.is_flank
|
|
283
|
+
& (self.is_flank | (self.side == "main"))
|
|
279
284
|
& self.deform.is_row_cluster
|
|
280
285
|
):
|
|
281
286
|
return group_data[self.deform.row_chunk_index]
|
|
@@ -610,6 +615,13 @@ class StatsBase(RenderPlan):
|
|
|
610
615
|
ax.set_xlim(*lims) if is_h else ax.set_ylim(*lims)
|
|
611
616
|
|
|
612
617
|
def render(self, axes):
|
|
618
|
+
# check if self._plan_label.loc is None
|
|
619
|
+
is_loc = False
|
|
620
|
+
props = None
|
|
621
|
+
if self._plan_label is not None:
|
|
622
|
+
if self._plan_label.loc is not None:
|
|
623
|
+
is_loc = True
|
|
624
|
+
props = self._plan_label.props
|
|
613
625
|
if self.is_split:
|
|
614
626
|
for spec in self.get_render_spec(axes):
|
|
615
627
|
self.render_ax(spec)
|
|
@@ -619,11 +631,13 @@ class StatsBase(RenderPlan):
|
|
|
619
631
|
# leave axis for the first ax
|
|
620
632
|
if (i == 0) & (self.get_orient() == "v"):
|
|
621
633
|
self._setup_axis(ax)
|
|
622
|
-
|
|
634
|
+
if not is_loc:
|
|
635
|
+
ax.set_ylabel(self.label, fontdict=props)
|
|
623
636
|
# leave axis for the last ax
|
|
624
637
|
elif (i == len(axes) - 1) & (self.get_orient() == "h"):
|
|
625
638
|
self._setup_axis(ax)
|
|
626
|
-
|
|
639
|
+
if not is_loc:
|
|
640
|
+
ax.set_xlabel(self.label, fontdict=props)
|
|
627
641
|
else:
|
|
628
642
|
ax.set_axis_off()
|
|
629
643
|
else:
|
|
@@ -632,6 +646,11 @@ class StatsBase(RenderPlan):
|
|
|
632
646
|
self._setup_axis(axes)
|
|
633
647
|
if self.label is not None:
|
|
634
648
|
if self.get_orient() == "v":
|
|
635
|
-
|
|
649
|
+
if not is_loc:
|
|
650
|
+
axes.set_ylabel(self.label, fontdict=props)
|
|
636
651
|
else:
|
|
637
|
-
|
|
652
|
+
if not is_loc:
|
|
653
|
+
axes.set_xlabel(self.label, fontdict=props)
|
|
654
|
+
|
|
655
|
+
if self.allow_labeling & is_loc:
|
|
656
|
+
self._plan_label.add(axes, self.side)
|
marsilea/plotter/mesh.py
CHANGED
|
@@ -430,6 +430,12 @@ class SizedMesh(MeshBase):
|
|
|
430
430
|
The width of the border of each elements
|
|
431
431
|
frameon : bool
|
|
432
432
|
Whether to draw a frame
|
|
433
|
+
grid : bool
|
|
434
|
+
Whether to draw grid
|
|
435
|
+
grid_color : color
|
|
436
|
+
The color of grid
|
|
437
|
+
grid_linewidth : float
|
|
438
|
+
The width of grid line
|
|
433
439
|
palette : dict
|
|
434
440
|
Use to map color if input categorical data
|
|
435
441
|
marker : str
|
|
@@ -494,6 +500,9 @@ class SizedMesh(MeshBase):
|
|
|
494
500
|
edgecolor=None,
|
|
495
501
|
linewidth=1,
|
|
496
502
|
frameon=True,
|
|
503
|
+
grid=False,
|
|
504
|
+
grid_color=".8",
|
|
505
|
+
grid_linewidth=1,
|
|
497
506
|
palette=None,
|
|
498
507
|
marker="o",
|
|
499
508
|
label=None,
|
|
@@ -534,8 +543,8 @@ class SizedMesh(MeshBase):
|
|
|
534
543
|
if palette is not None:
|
|
535
544
|
encoder = {}
|
|
536
545
|
render_colors = []
|
|
537
|
-
for i, (
|
|
538
|
-
encoder[
|
|
546
|
+
for i, (plabel, c) in enumerate(palette.items()):
|
|
547
|
+
encoder[plabel] = i
|
|
539
548
|
render_colors.append(c)
|
|
540
549
|
self.cmap = ListedColormap(render_colors)
|
|
541
550
|
self.color2d = encode_numeric(color, encoder)
|
|
@@ -548,6 +557,9 @@ class SizedMesh(MeshBase):
|
|
|
548
557
|
self.edgecolor = edgecolor
|
|
549
558
|
self.linewidth = linewidth
|
|
550
559
|
self.set_label(label, label_loc, label_props)
|
|
560
|
+
self.grid = grid
|
|
561
|
+
self.grid_color = grid_color
|
|
562
|
+
self.grid_linewidth = grid_linewidth
|
|
551
563
|
self.kwargs = kwargs
|
|
552
564
|
|
|
553
565
|
self._collections = None
|
|
@@ -606,6 +618,16 @@ class SizedMesh(MeshBase):
|
|
|
606
618
|
yticks = np.arange(Y) + 0.5
|
|
607
619
|
xv, yv = np.meshgrid(xticks, yticks)
|
|
608
620
|
|
|
621
|
+
if self.grid:
|
|
622
|
+
for x in xticks:
|
|
623
|
+
ax.axvline(
|
|
624
|
+
x, color=self.grid_color, linewidth=self.grid_linewidth, zorder=0
|
|
625
|
+
)
|
|
626
|
+
for y in yticks:
|
|
627
|
+
ax.axhline(
|
|
628
|
+
y, color=self.grid_color, linewidth=self.grid_linewidth, zorder=0
|
|
629
|
+
)
|
|
630
|
+
|
|
609
631
|
options = dict(
|
|
610
632
|
s=size,
|
|
611
633
|
edgecolor=self.edgecolor,
|
marsilea/upset.py
CHANGED
|
@@ -474,7 +474,10 @@ class Upset(WhiteBoard):
|
|
|
474
474
|
Whether or which side to add the label.
|
|
475
475
|
width : float
|
|
476
476
|
height : float
|
|
477
|
-
|
|
477
|
+
size_scale : float
|
|
478
|
+
The scale of the plot
|
|
479
|
+
size_aspect : float
|
|
480
|
+
The aspect ratio of the plot
|
|
478
481
|
|
|
479
482
|
Examples
|
|
480
483
|
--------
|
|
@@ -514,6 +517,8 @@ class Upset(WhiteBoard):
|
|
|
514
517
|
add_labels=True,
|
|
515
518
|
width=None,
|
|
516
519
|
height=None,
|
|
520
|
+
size_scale=0.3,
|
|
521
|
+
size_aspect=1.0,
|
|
517
522
|
):
|
|
518
523
|
# The modification happens inplace
|
|
519
524
|
upset_data = data
|
|
@@ -567,7 +572,11 @@ class Upset(WhiteBoard):
|
|
|
567
572
|
self.orient = orient
|
|
568
573
|
|
|
569
574
|
width, height = get_canvas_size_by_data(
|
|
570
|
-
main_shape,
|
|
575
|
+
main_shape,
|
|
576
|
+
scale=size_scale,
|
|
577
|
+
width=width,
|
|
578
|
+
height=height,
|
|
579
|
+
aspect=size_aspect,
|
|
571
580
|
)
|
|
572
581
|
|
|
573
582
|
super().__init__(width=width, height=height)
|
|
@@ -717,6 +726,7 @@ class Upset(WhiteBoard):
|
|
|
717
726
|
raise ValueError(msg)
|
|
718
727
|
|
|
719
728
|
def add_intersections(self, side, pad=0.1, size=1.0):
|
|
729
|
+
self._add_intersections = True
|
|
720
730
|
self._check_side(
|
|
721
731
|
side, "Intersections", dict(h=["top", "bottom"], v=["left", "right"])
|
|
722
732
|
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
marsilea/__init__.py,sha256=TJ1LRb_ML9gOV-uhUijRCVqEkCZkrCk0MFgrmB5z574,541
|
|
2
|
+
marsilea/_api.py,sha256=tymWZHfjhx8-0NNd9762znfdIu36NrARRweEIr5L1mA,283
|
|
3
|
+
marsilea/_deform.py,sha256=SKXLvhyUrwTRAw7Fl--OpupDLk6T3S5DRfwCAdewHQs,14138
|
|
4
|
+
marsilea/base.py,sha256=wgKuOp8GKttwqC6_YdtR7RzFdxbOc-7iVjTlY0T0h44,46192
|
|
5
|
+
marsilea/dataset.py,sha256=a0mXjPu9_tRGHofnnQaTryFpxftkfqldq_ZLXMSBf7A,4410
|
|
6
|
+
marsilea/dendrogram.py,sha256=WUnV2JMSY9mPt1sfkFAEikkl2ta7xHFD13teas_iZgE,14767
|
|
7
|
+
marsilea/exceptions.py,sha256=Wxy31eCWkoXTPwqaa7R5F7cJ3uCtzqhJXmxVqqX8eAA,661
|
|
8
|
+
marsilea/heatmap.py,sha256=lKGt0lTtziNFDsb_SBfFt3zoYzVYRzezc9aae5RxHyk,4168
|
|
9
|
+
marsilea/layers.py,sha256=puXLlGGpEqAzaTqadpgpsYmIDPH33WyyHIuysRSqFZQ,12163
|
|
10
|
+
marsilea/layout.py,sha256=X8MGPlAbbr7dcZiqW4pI7sEb8U3jVaiS7t1DKOqMYLI,27758
|
|
11
|
+
marsilea/upset.py,sha256=U1Rsmo1WpCAV9z3LBlE2L4T0nAW9ols8Z36fXzmXycw,30388
|
|
12
|
+
marsilea/utils.py,sha256=IaAaOBdE668XuGiA-k_gmOtHYqfpIxPv_-molMSBPfs,2851
|
|
13
|
+
marsilea/plotter/__init__.py,sha256=n1E53C5oqnsHZcXAtN6HgZsZdcAvANONNx-fupTxzN0,738
|
|
14
|
+
marsilea/plotter/_images.py,sha256=RWCI4FhcxJZimLrhdy9CHw3ri1kweGRICUyByE4wzmg,3065
|
|
15
|
+
marsilea/plotter/_seaborn.py,sha256=aK0EnboshfNCNvNjsIc7dxDE_4KBKi4HMUt7CKWt_6U,8188
|
|
16
|
+
marsilea/plotter/_utils.py,sha256=Efhdk-TrrAanhbXRiEVWThMYvZ4vVHZMVYMs5X3JvIM,710
|
|
17
|
+
marsilea/plotter/arc.py,sha256=PFXlJ0TBIJ1mEB-lIl-Zs2UdEXkLSwDlRJbsSa5Ss5U,8165
|
|
18
|
+
marsilea/plotter/area.py,sha256=zjjAhvgKHYe9rqzcseqZqhwfpgvzm0w2FRJ_vr9Fxm4,2650
|
|
19
|
+
marsilea/plotter/bar.py,sha256=TeX6li--kE9NtqCRflDTX0jkG1-uIq0Dn8ILKSv-AuA,12080
|
|
20
|
+
marsilea/plotter/base.py,sha256=0UiJqNefv9mieMB0ICpKQ2rXqGaFYigqyxQe4BzBP24,20321
|
|
21
|
+
marsilea/plotter/bio.py,sha256=_pZkGoAei7eirFCpu7AcZJhebBneNjUKcZlI36bpqUE,5044
|
|
22
|
+
marsilea/plotter/mesh.py,sha256=ArioOXZJpD1T2wrYDmm_cFQpUmq_3q7W_qrJ_zCX3zU,23793
|
|
23
|
+
marsilea/plotter/text.py,sha256=oYJ5py3_nGHKi60DSVzFgPg4drnTSTw__IcYs0cut4M,36222
|
|
24
|
+
marsilea-0.3.6.dist-info/LICENSE,sha256=2TLD8FnLJqXzg8YBRs7W3VZBwfWfp4ArDfBl-rn96Qc,1074
|
|
25
|
+
marsilea-0.3.6.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
26
|
+
marsilea-0.3.6.dist-info/METADATA,sha256=COXhGBcv1dJZ9uI_TuMX3FV5dun7yTkAkw0orGCeFjQ,4074
|
|
27
|
+
marsilea-0.3.6.dist-info/RECORD,,
|
marsilea-0.3.5.dist-info/RECORD
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
marsilea/__init__.py,sha256=MK00zrdKPjFGFcfH0KfoZz9MZhkYffJ-QTwDtzELohs,533
|
|
2
|
-
marsilea/_api.py,sha256=tymWZHfjhx8-0NNd9762znfdIu36NrARRweEIr5L1mA,283
|
|
3
|
-
marsilea/_deform.py,sha256=SKXLvhyUrwTRAw7Fl--OpupDLk6T3S5DRfwCAdewHQs,14138
|
|
4
|
-
marsilea/base.py,sha256=YQNgkLPX2RoQzhLdEaxf6ZLFECjAqXdye9G5XG64sAY,45869
|
|
5
|
-
marsilea/dataset.py,sha256=a0mXjPu9_tRGHofnnQaTryFpxftkfqldq_ZLXMSBf7A,4410
|
|
6
|
-
marsilea/dendrogram.py,sha256=WUnV2JMSY9mPt1sfkFAEikkl2ta7xHFD13teas_iZgE,14767
|
|
7
|
-
marsilea/exceptions.py,sha256=Wxy31eCWkoXTPwqaa7R5F7cJ3uCtzqhJXmxVqqX8eAA,661
|
|
8
|
-
marsilea/heatmap.py,sha256=lKGt0lTtziNFDsb_SBfFt3zoYzVYRzezc9aae5RxHyk,4168
|
|
9
|
-
marsilea/layers.py,sha256=puXLlGGpEqAzaTqadpgpsYmIDPH33WyyHIuysRSqFZQ,12163
|
|
10
|
-
marsilea/layout.py,sha256=X8MGPlAbbr7dcZiqW4pI7sEb8U3jVaiS7t1DKOqMYLI,27758
|
|
11
|
-
marsilea/upset.py,sha256=12ExZ6yUQocd3bSLYtizEblJgILn_QCQaoeP-SP2q9E,30138
|
|
12
|
-
marsilea/utils.py,sha256=IaAaOBdE668XuGiA-k_gmOtHYqfpIxPv_-molMSBPfs,2851
|
|
13
|
-
marsilea/plotter/__init__.py,sha256=aEN-Yta4USY5_l-D97XYySALEgxMmFieA08DzK3xdB4,737
|
|
14
|
-
marsilea/plotter/_images.py,sha256=BC9iyWBLVY-nmUW1pSZq06pwHZN1MrW2psMIDreLReg,3062
|
|
15
|
-
marsilea/plotter/_seaborn.py,sha256=XePOYnIFf9lDXXZffSL-YKSV162hKOWsvuxAvH2oHQo,8111
|
|
16
|
-
marsilea/plotter/_utils.py,sha256=Efhdk-TrrAanhbXRiEVWThMYvZ4vVHZMVYMs5X3JvIM,710
|
|
17
|
-
marsilea/plotter/arc.py,sha256=iBAvQeYLMNaXsykkpE6BJN1CTaBNntlfispFV2LvSUE,8102
|
|
18
|
-
marsilea/plotter/area.py,sha256=UOI8xdXMORXdgEG7fT9Lmx3Zk0_7XZl9nMw9A_CZkKA,2590
|
|
19
|
-
marsilea/plotter/bar.py,sha256=jbWukeTkUSge_TLC3ikJeg7GLHG4WuyN6EwIERvh0sc,11976
|
|
20
|
-
marsilea/plotter/base.py,sha256=Kzp0474WlXQse5jK4kLPtkVQLH9zpEwYNocV4c0CD-A,19621
|
|
21
|
-
marsilea/plotter/bio.py,sha256=_pZkGoAei7eirFCpu7AcZJhebBneNjUKcZlI36bpqUE,5044
|
|
22
|
-
marsilea/plotter/mesh.py,sha256=JctVkK5xjsUnRjX2ik3ntL-k-Didi7OAUfdmgkZu6IQ,23116
|
|
23
|
-
marsilea/plotter/text.py,sha256=oYJ5py3_nGHKi60DSVzFgPg4drnTSTw__IcYs0cut4M,36222
|
|
24
|
-
marsilea-0.3.5.dist-info/LICENSE,sha256=2TLD8FnLJqXzg8YBRs7W3VZBwfWfp4ArDfBl-rn96Qc,1074
|
|
25
|
-
marsilea-0.3.5.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
26
|
-
marsilea-0.3.5.dist-info/METADATA,sha256=WNby0TTARbfq5zrKSbelRLRchsPRURRraukRSnZYO64,4055
|
|
27
|
-
marsilea-0.3.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|