Skip to content

Commit c54b352

Browse files
committed
update to 1.5.4
1 parent e68e294 commit c54b352

155 files changed

Lines changed: 5933 additions & 2705 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

PyComplexHeatmap/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
from .utils import set_default_style
1111

1212
# __all__=['*']
13-
__version__ = "1.5.3"
13+
__version__ = "1.5.4"
1414

1515
_ROOT = os.path.abspath(os.path.dirname(__file__))

PyComplexHeatmap/annotations.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ class AnnotationBase:
5959
----------
6060
Class AnnotationBase.
6161
"""
62-
6362
def __init__(
6463
self,
6564
df=None,
@@ -225,12 +224,8 @@ def _calculate_cmap(self):
225224
def _type_specific_params(self):
226225
pass
227226

228-
def reorder(
229-
self, idx
230-
): # Before plotting, df needs to be reordered according to the new clustered order.
231-
"""
232-
idx: list
233-
"""
227+
def reorder(self, idx):
228+
# Before plotting, df needs to be reordered according to the new clustered order.
234229
# n_overlap = len(set(self.df.index.tolist()) & set(idx))
235230
# if n_overlap == 0:
236231
# raise ValueError("The input idx is not consistent with the df.index")
@@ -243,7 +238,7 @@ def reorder(
243238
def get_label_width(self):
244239
return self.ax.yaxis.label.get_window_extent(
245240
renderer=self.ax.figure.canvas.get_renderer()
246-
).width #
241+
).width
247242

248243
def get_ticklabel_width(self):
249244
yticklabels = self.ax.yaxis.get_ticklabels()
@@ -266,9 +261,8 @@ def get_max_label_width(self):
266261
# =============================================================================
267262
class anno_simple(AnnotationBase):
268263
"""
269-
Annotate simple annotation, categorical or continuous variables.
264+
Annotate simple annotation, categorical or continuous variables.
270265
"""
271-
272266
def __init__(
273267
self,
274268
df=None,
@@ -456,7 +450,6 @@ class anno_label(AnnotationBase):
456450
Class AnnotationBase.
457451
458452
"""
459-
460453
def __init__(
461454
self,
462455
df=None,
@@ -1175,7 +1168,6 @@ class HeatmapAnnotation:
11751168
Class HeatmapAnnotation.
11761169
11771170
"""
1178-
11791171
def __init__(
11801172
self,
11811173
df=None,

PyComplexHeatmap/clustermap.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,7 @@ def plot_heatmap(
542542
):
543543
"""
544544
Plot heatmap.
545-
heatmap(self.data2d.loc[rows, cols], ax=ax1,cmap=self.cmap,
546-
mask=self.mask.loc[rows, cols], rasterized=self.rasterized,
547-
xticklabels='auto', yticklabels='auto', annot=annot1, **self.kwargs)
545+
548546
Parameters
549547
----------
550548
data: dataframe
@@ -709,7 +707,6 @@ class DendrogramPlotter(object):
709707
def __init__(
710708
self, data, linkage, metric, method, axis, label, rotate, dendrogram_kws=None
711709
):
712-
"""Plot a dendrogram of the relationships between the columns of data"""
713710
self.axis = axis
714711
if (
715712
self.axis == 1
@@ -949,6 +946,10 @@ class ClusterMapPlotter:
949946
kws passed to hierarchy.dendrogram.
950947
tree_kws :dict
951948
kws passed to DendrogramPlotter.plot()
949+
row_split_order: list
950+
a list to specify the order of row_split.
951+
col_split_order: list
952+
a list to specify the order of col_split.
952953
row_split_gap :float
953954
default are 0.5 and 0.2 mm for row and col.
954955
col_split_gap :float
@@ -961,14 +962,14 @@ class ClusterMapPlotter:
961962
True or False, whether to plot heatmap legend, determined by cmap.
962963
legend_kws :dict
963964
kws passed to plot legend. If one want to change the outline color and linewidth of cbar:
964-
```
965+
965966
for cbar in cm.cbars:
966967
if isinstance(cbar,matplotlib.colorbar.Colorbar):
967968
cbar.outline.set_color('white')
968969
cbar.outline.set_linewidth(2)
969970
cbar.dividers.set_color('red')
970971
cbar.dividers.set_linewidth(2)
971-
```
972+
972973
plot :bool
973974
whether to plot or not.
974975
plot_legend :bool
@@ -1006,7 +1007,6 @@ class ClusterMapPlotter:
10061007
-------
10071008
Class ClusterMapPlotter.
10081009
"""
1009-
10101010
def __init__(
10111011
self,
10121012
data,

PyComplexHeatmap/dotHeatmap.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ class DotClustermapPlotter(ClusterMapPlotter):
297297
-------
298298
DotClustermapPlotter.
299299
"""
300-
301300
def __init__(
302301
self,
303302
data=None,

PyComplexHeatmap/oncoPrint.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ class oncoPrintPlotter(ClusterMapPlotter):
185185
-------
186186
oncoPrintPlotter.
187187
"""
188-
189188
def __init__(
190189
self,
191190
data=None,

PyComplexHeatmap/utils.py

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,18 @@ def get_colormap(cmap):
4545

4646
def _check_mask(data, mask):
4747
"""
48-
49-
Ensure that data and mask are compatible and add missing values and infinite values.
48+
Ensure that data and mask are compatible and add missing values and infinite values.
5049
Values will be plotted for cells where ``mask`` is ``False``.
51-
``data`` is expected to be a DataFrame; ``mask`` can be an array or
52-
a DataFrame.
50+
``data`` is expected to be a DataFrame; ``mask`` can be an array or a DataFrame.
51+
52+
Parameters
53+
----------
54+
data
55+
mask
56+
57+
Returns
58+
-------
59+
5360
"""
5461
if mask is None:
5562
mask = np.zeros(data.shape, bool)
@@ -94,7 +101,10 @@ def _calculate_luminance(color):
94101
def define_cmap(
95102
plot_data, vmin=None, vmax=None, cmap=None, center=None, robust=True, na_col="white"
96103
):
97-
"""Use some heuristics to set good defaults for colorbar and range."""
104+
"""
105+
Use some heuristics to set good defaults for colorbar and range.
106+
107+
"""
98108
# plot_data is a np.ma.array instance
99109
# plot_data=np.ma.masked_where(np.asarray(plot_data), plot_data)
100110
# calc_data = plot_data.astype(float).filled(np.nan)
@@ -240,7 +250,10 @@ def axis_ticklabels_overlap(labels):
240250
# =============================================================================
241251
# =============================================================================
242252
def _skip_ticks(labels, tickevery):
243-
"""Return ticks and labels at evenly spaced intervals."""
253+
"""
254+
Return ticks and labels at evenly spaced intervals.
255+
256+
"""
244257
n = len(labels)
245258
if tickevery == 0:
246259
ticks, labels = [], []
@@ -255,7 +268,10 @@ def _skip_ticks(labels, tickevery):
255268

256269
# =============================================================================
257270
def _auto_ticks(ax, labels, axis):
258-
"""Determine ticks and ticklabels that minimize overlap."""
271+
"""
272+
Determine ticks and ticklabels that minimize overlap.
273+
274+
"""
259275
transform = ax.figure.dpi_scale_trans.inverted()
260276
bbox = ax.get_window_extent().transformed(transform)
261277
size = [bbox.width, bbox.height][axis]
-276 Bytes
Binary file not shown.
-1.61 KB
Binary file not shown.
1.32 KB
Binary file not shown.
38.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)