Skip to content

Commit

Permalink
Merge pull request #52 from sbslee/1.16.0-dev
Browse files Browse the repository at this point in the history
1.16.0 dev
  • Loading branch information
sbslee authored Dec 27, 2022
2 parents a3248dd + 4585cb0 commit 7127c98
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
*********

1.16.0 (2022-12-27)
-------------------

* Add new argument ``palette`` to :meth:`taxa_abundance_box_plot` method.
* :issue:`51`: Fix bug in :meth:`clustermap` method where color labels disappeared when ``flip=True``.

1.15.0 (2022-08-23)
-------------------

Expand Down
Binary file modified docs/images/clustermap-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 15 additions & 8 deletions dokdo/api/clustermap.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,13 @@ def clustermap(
.. image:: images/clustermap-3.png
We can add an additional grouping variable ``subject``. Note that
``xticklabels`` and ``yticklabels`` are extra keyword arguments that
are passed to :meth:`seaborn.clustermap`.
We can add an additional grouping variable ``subject``. This may require
you to use ``bbox_inches='tight'`` option in the :meth:`plt.savefig`
method when saving the figure as a file (e.g. PNG) because otherwise
there could be weird issues with the legends (because there are now two
legends instead of just one). Additionally, note that ``xticklabels``
and ``yticklabels`` are extra keyword arguments that are passed to
:meth:`seaborn.clustermap`.
.. code:: python3
Expand All @@ -350,6 +354,7 @@ def clustermap(
hue2='subject',
xticklabels=False,
yticklabels=False)
plt.savefig('out.png', bbox_inches='tight')
.. image:: images/clustermap-4.png
Expand Down Expand Up @@ -410,11 +415,13 @@ def clustermap(
# Flip the axes.
if flip:
df = df.T

# Draw the heatmap.
g = sns.clustermap(df, method=method, metric=metric, figsize=figsize,
row_cluster=row_cluster, col_cluster=col_cluster,
row_colors=row_colors, **kwargs)
g = sns.clustermap(df, method=method, metric=metric, figsize=figsize,
row_cluster=row_cluster, col_cluster=col_cluster,
col_colors=row_colors, **kwargs)
else:
g = sns.clustermap(df, method=method, metric=metric, figsize=figsize,
row_cluster=row_cluster, col_cluster=col_cluster,
row_colors=row_colors, **kwargs)

# If the hue argument(s) are used, add the legend(s).
if hue1 is not None:
Expand Down
6 changes: 4 additions & 2 deletions dokdo/api/taxa_abundance.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ def taxa_abundance_box_plot(
sample_names=None, csv_file=None, pseudocount=False,
taxa_names=None, pretty_taxa=False, show_means=False,
meanprops=None, show_others=True, sort_by_mean=True,
add_datapoints=False, jitter=1, alpha=None, size=5,
add_datapoints=False, jitter=1, alpha=None, size=5, palette=None,
ax=None, figsize=None,
):
"""
Expand Down Expand Up @@ -729,6 +729,8 @@ def taxa_abundance_box_plot(
size : float, default: 5.0
Ignored when ``add_datapoints=False``. Radius of the markers, in
points.
palette : palette name, list, or dict
Box colors.
ax : matplotlib.axes.Axes, optional
Axes object to draw the plot onto, otherwise uses the current Axes.
figsize : tuple, optional
Expand Down Expand Up @@ -929,7 +931,7 @@ def taxa_abundance_box_plot(

sns.boxplot(
x='variable', y='value', hue=hue, hue_order=hue_order, data=df2,
ax=ax, **d
ax=ax, palette=palette, **d
)

if add_datapoints:
Expand Down
2 changes: 1 addition & 1 deletion dokdo/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.15.0'
__version__ = '1.16.0'

0 comments on commit 7127c98

Please sign in to comment.