Skip to content

Commit

Permalink
couple fixes for plotting in new docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
psathyrella committed Feb 24, 2024
1 parent 971c326 commit bda23df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ RUN apt-get --allow-releaseinfo-change update && apt-get install -y \
build-essential \
cmake \
emacs \
fonts-lato \
libboost-dev \
libgsl-dev \
libncurses-dev \
Expand All @@ -17,10 +18,13 @@ RUN apt-get --allow-releaseinfo-change update && apt-get install -y \
libz-dev \
ncbi-blast+ \
python3-pyqt5 \
vim
vim \
xvfb
USER $MAMBA_USER
ARG MAMBA_DOCKERFILE_ACTIVATE=1
RUN micromamba install -y -cconda-forge -cbioconda -cbiocore python biopython pandas psutil pysam scons seaborn zlib pyyaml scikit-learn mafft # -cbioconda is for pysam, -cbiocore is for mafft
RUN micromamba install -y -c conda-forge -c bioconda -cbiocore -c etetoolkit \
python biopython pandas psutil pysam scons seaborn zlib pyyaml scikit-learn \
mafft circlify ete3 # ete_toolchain
RUN pip install colored-traceback dendropy levenshtein
COPY --chown=$MAMBA_USER:$MAMBA_USER_GID . /partis
WORKDIR /partis
Expand Down
10 changes: 6 additions & 4 deletions python/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -1043,21 +1043,23 @@ def plot_legend_only(leg_entries, plotdir, plotname, title=None, n_digits=None):
tlab = utils.round_to_n_digits(tlab, 2)
ax.plot([None], [None], label=str(tlab), color=lfo['color'], linewidth=lfo.get('linewidth', 5), linestyle=lfo.get('linestyle', '-'), alpha=lfo.get('alpha', 0.6)) # str() is to convert None to 'None', otherwise it doesn't show up
handles, labels = ax.get_legend_handles_labels()
figlegend.legend(handles, labels, 'center', title=title)
figlegend.legend(handles, labels, loc='center', title=title)
figlegend.savefig(lfn)
return lfn

# ----------------------------------------------------------------------------------------
def mpl_init(figsize=None, fsize=20, label_fsize=15):
def mpl_init(figsize=None, fsize=20, label_fsize=15, fweight='bold'):
if 'seaborn' not in sys.modules:
import seaborn # really #$*$$*!ing slow to import, but only importing part of it doesn't seem to help
sys.modules['seaborn'].set_style('ticks')
mpl.rcParams.update({
'font.size': fsize, 'axes.titlesize': fsize, 'axes.labelsize': fsize,
'xtick.labelsize': label_fsize, 'ytick.labelsize': label_fsize, # NOTE this gets (maybe always?) overriden by xticklabelsize/yticklabelsize in mpl_finis()
'legend.fontsize': fsize,
'font.family': 'Lato', 'font.weight': 600,
'axes.labelweight': 600, 'axes.titleweight': 600,
'font.family': 'Lato',
'font.weight': fweight,
'axes.labelweight': fweight,
'axes.titleweight': fweight,
'figure.autolayout': True})
fig, ax = plt.subplots(figsize=figsize)
fig.tight_layout()
Expand Down

0 comments on commit bda23df

Please sign in to comment.