Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed a minor bug to match update to stdpopsim repo
- Loading branch information
1 parent
62ebb70
commit 75f4346
Showing
2 changed files
with
12 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,35 @@ | ||
""" | ||
Code for generating plots. | ||
""" | ||
|
||
import numpy as np | ||
import pandas | ||
import matplotlib | ||
from matplotlib import pyplot as plt | ||
# Force matplotlib to not use any Xwindows backend. | ||
matplotlib.use('Agg') | ||
from matplotlib import pyplot as plt | ||
import pandas | ||
|
||
def plot_stairway_Ne_estimate(infile, outfile): | ||
|
||
def plot_stairway_Ne_estimate(infile, outfile): | ||
""" | ||
figure of N(t) for single run of stairwayplot | ||
""" | ||
nt = pandas.read_csv(infile, sep="\t", skiprows=5) | ||
nt = nt[nt['year'] > 10] | ||
f, ax = plt.subplots(figsize=(7, 7)) | ||
ax.set(xscale="log", yscale="log") | ||
# JK: turned off these limits as they weren't working for me. | ||
# ylim=(np.min(nt['Ne_2.5%']-np.std(nt['Ne_2.5%'])), | ||
# np.max(nt['Ne_97.5%'])+np.std(nt['Ne_97.5%']))) | ||
ax.plot(nt['year'], nt['Ne_median'], c="red") | ||
ax.plot(nt['year'], nt['Ne_2.5%'], c='grey') | ||
ax.plot(nt['year'], nt['Ne_97.5%'], c='grey') | ||
f.savefig(outfile, bbox_inches='tight') | ||
|
||
def plot_compound_Ne_estimate(infiles, outfile): | ||
|
||
def plot_compound_Ne_estimate(infiles, outfile): | ||
""" | ||
figure of N(t) for multiple runs of stairwayplot | ||
""" | ||
f, ax = plt.subplots(figsize=(7, 7)) | ||
ax.set(xscale="log", yscale="log") | ||
for infile in infiles: | ||
nt = pandas.read_csv(infile, sep="\t", skiprows=5) | ||
nt = nt[nt['year'] > 10] | ||
# JK: turned off these limits as they weren't working for me. | ||
# ylim=(np.min(nt['Ne_2.5%']-np.std(nt['Ne_2.5%'])), | ||
# np.max(nt['Ne_97.5%'])+np.std(nt['Ne_97.5%']))) | ||
ax.plot(nt['year'], nt['Ne_median'], c="red") | ||
# ax.plot(nt['year'], nt['Ne_2.5%'], c='grey') | ||
# ax.plot(nt['year'], nt['Ne_97.5%'], c='grey') | ||
|
||
f.savefig(outfile, bbox_inches='tight') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters