Skip to content

Commit

Permalink
adjust plot sizing
Browse files Browse the repository at this point in the history
  • Loading branch information
jethror1 committed Oct 5, 2020
1 parent 80f4f99 commit 33a281f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions bin/coverage_report_single.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def load_files(self, threshold, exon_stats,
# format according to output of
# https://github.com/eastgenomics/eggd_generate_bed
panel_name = panel_name.replace("_", " ").strip()
panel_name = panel_name.replace("&", ", ")
panel_name = panel_name.replace("&", ",&nbsp&nbsp")

panel = "<li>Panel(s) / gene(s) included in report: <b>{}</b>\
</li>".format(panel_name)
Expand Down Expand Up @@ -721,7 +721,7 @@ def summary_gene_plot(self, cov_summary, threshold):

cov_summary = cov_summary.sort_values(by=[threshold], ascending=False)

summary_plot, axs = plt.subplots(figsize=(18, 7.5))
summary_plot, axs = plt.subplots(figsize=(22, 7.5))
plt.bar(
cov_summary["gene"], [int(x) for x in cov_summary[threshold]],
color=cov_summary.colours
Expand All @@ -736,11 +736,15 @@ def summary_gene_plot(self, cov_summary, threshold):

# plot formatting
axs.tick_params(labelsize=6, length=0)
plt.xticks(rotation=35, color="#565656")
plt.xticks(rotation=55, color="#565656")

# adjust whole plot marins
axs.margins(x=0.01)
axs.autoscale_view(scaley=True)

vals = np.arange(0, 110, 10).tolist()
plt.yticks(vals, vals)
axs.tick_params(axis='both', which='major', labelsize=10)
axs.tick_params(axis='both', which='major', labelsize=8)

plt.xlabel("")
plt.ylabel("% coverage ({})".format(threshold), fontsize=11)
Expand Down Expand Up @@ -872,7 +876,7 @@ def generate_report(self, cov_stats, cov_summary, snps_low_cov,
sub_threshold_stats = sub_threshold_stats.rename(columns={
"gene": "Gene",
"tx": "Transcript",
"chrom": "Chromosome",
"chrom": "Chr",
"exon": "Exon",
"exon_len": "Length",
"exon_start": "Start",
Expand All @@ -894,7 +898,7 @@ def generate_report(self, cov_stats, cov_summary, snps_low_cov,
total_stats = total_stats.rename(columns={
"gene": "Gene",
"tx": "Transcript",
"chrom": "Chromosome",
"chrom": "Chr",
"exon": "Exon",
"exon_len": "Length",
"exon_start": "Start",
Expand Down

0 comments on commit 33a281f

Please sign in to comment.