Skip to content

Commit

Permalink
Fixed bug with categorical annotation bar cmaps
Browse files Browse the repository at this point in the history
  • Loading branch information
wflynny committed Jul 10, 2020
1 parent 29e0f93 commit 7af3664
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions post_processing/plate_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pandas as pd
import matplotlib.tri as tri
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm, Normalize
from matplotlib.colors import LogNorm, Normalize, ListedColormap
from matplotlib.backends.backend_pdf import PdfPages
import seaborn as sns
import cmocean
Expand All @@ -15,6 +15,9 @@
plt.rcParams["xtick.major.pad"] = 0





def add_timestamp(fig):
ts = datetime.strftime(datetime.now(), "%Y-%m-%dT%H:%M:%S")
fig.text(1.0, 0.0, ts, va="bottom", ha="right", size="xx-small")
Expand Down Expand Up @@ -126,13 +129,13 @@ def plot_plate_data(ax, data, cmap_or_palette, vmin=1e-6, cbar_ax=None, log=Fals
hm = sns.heatmap(
ax=ax,
data=plate_data,
vmin=vmin,
vmin=vmin if cbar_ax is not None else None,
xticklabels=plate_data.columns,
yticklabels=plate_data.index,
cmap=cmap_or_palette,
cbar=cbar_ax is not None,
cbar_ax=cbar_ax,
norm=LogNorm() if log else Normalize(),
norm=LogNorm() if log else None,#Normalize(),
linewidths=0.5, linecolor="k"
)
ax.set_xlabel("")
Expand Down Expand Up @@ -240,7 +243,6 @@ def plate_qc(data):
return fig



def plot_randomization(data):
data = data.loc[~data.index.duplicated(), :]

Expand Down Expand Up @@ -296,10 +298,10 @@ def plot_measurements(data, ncols=4, measurement_cols=None):


if __name__ == "__main__":
data_path = Path("testfile.csv")
data_path = Path("test_data/results.csv")
prefix = data_path.stem

data = pd.read_csv("testfile.csv", index_col=0)
data = pd.read_csv(data_path, index_col=0)
outfile = f"{prefix}_qc-plots.pdf"
pdf = PdfPages(outfile)
figs = [
Expand Down

0 comments on commit 7af3664

Please sign in to comment.