Skip to content

Commit

Permalink
Update barplot color handling (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
wdecoster committed Dec 9, 2024
1 parent e0065eb commit 3d578b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion nanocomp/compplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,12 @@ def output_barplot(df, path, settings, title=None):

counts = df["dataset"].value_counts(sort=False)

colordict = {}

read_count.fig = go.Figure()
for idx, count, color in zip(counts.index, counts, palette):
read_count.fig.add_trace(go.Bar(x=[idx], y=[count], name=idx, marker_color=color))
colordict[idx] = color

read_count.fig.update_layout(
title_text=title or read_count.title,
Expand All @@ -153,7 +156,8 @@ def output_barplot(df, path, settings, title=None):

throughput = df.groupby("dataset", sort=False)[length_column].sum()
throughput_bases.fig = go.Figure()
for idx, sum_dataset, color in zip(throughput.index, throughput, palette):
for idx, sum_dataset in zip(throughput.index, throughput):
color = colordict.get(idx, "blue")
throughput_bases.fig.add_trace(
go.Bar(x=[idx], y=[sum_dataset], name=idx, marker_color=color)
)
Expand Down
2 changes: 1 addition & 1 deletion nanocomp/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.24.1"
__version__ = "1.24.2"

0 comments on commit 3d578b6

Please sign in to comment.