From eed9eae4e110855ef3040365daf5615596156b38 Mon Sep 17 00:00:00 2001 From: Blaise Li <blaise.li__git@nsup.org> Date: Tue, 30 Jan 2018 13:18:23 +0100 Subject: [PATCH] Log-scaled axes in paired scatterplots. --- libhts/libhts.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libhts/libhts.py b/libhts/libhts.py index edce5a9..24b9e20 100644 --- a/libhts/libhts.py +++ b/libhts/libhts.py @@ -473,7 +473,7 @@ def plot_scatter(data, x=x_column, y=y_column, s=1, c=group2colour[status], label=f"{status} ({len(group)})", ax=ax) else: - # Apply a coulour to a list of genes + # Apply a colour to a list of genes (status, colour) = group2colour row_indices = data.index.intersection(grouping) try: @@ -507,11 +507,15 @@ def plot_scatter(data, ax.set_ylim(y_range) return ax -def plot_paired_scatters(data, columns=None, hue=None): +def plot_paired_scatters(data, columns=None, hue=None, log_log=False): """Alternative to pairplot, in order to avoid histograms on the diagonal.""" if columns is None: columns = data.columns g = sns.PairGrid(data, vars=columns, hue=hue, size=8) #g.map_offdiag(plt.scatter, marker=".") g.map_lower(plt.scatter, marker=".") + if log_log: + for ax in g.axes.ravel(): + ax.set_xscale('log') + ax.set_yscale('log') g.add_legend() -- GitLab