ryanlayer/samplot

png files with additional tick labels

warthmann opened this issue · 4 comments

Hello,
I have installed samplot through conda. During some plots I am getting a warning, ie.

/samplot.py:3014: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
curr_ax.set_xticklabels(labels, fontsize=xaxis_label_fontsize)

and also I do have additional tick marks in my pngs. It concerns all plots. An example is attached. Help in removing those tick marks is apppreciated
thanks a lot
best
Norman
Screenshot from 2023-11-09 15-37-08

Could you please try running the develop version of samplot. You can install this using e.g.

pip install git+https://github.com/ryanlayer/samplot.git

There has been a lot of changes since the latest conda version so please test this and see if the problems still appear.

Adoni5 commented

I was just about to open this issue - I am running the develop version, (or v1.3.1 at any rate) - originally installed via conda, upgraded via the above pip command.

Command

time python -m samplot plot     -n "PromethION NA12878" "PromethION NB4" "Promethion 22Rv1" -b all_barcode05.sequenc
ed.fastq.bam all_barcode06.sequenced.fastq.bam all_barcode06.sequenced.fastq.bam -o figure_4_prom.png     -c chr17     -s 40245924     -e 40445924 -c chr15 -s 73934033 -e 74134033 -t BND
/home/prom/miniforge3/envs/samplot/lib/python3.10/site-packages/samplot/samplot.py:2911: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ti
cks() or using a FixedLocator.                                                                                                                                                            
  curr_ax.set_xticklabels(labels, fontsize=xaxis_label_fontsize)                                                                                                                          
                                                                                                                                                                                          
real    0m16.659s                                                                                                                                                                         
user    0m20.635s                                                                                                                                                                         
sys     0m6.787s 

Version

python -m samplot --version                                                                                         
samplot 1.3.1       

Plot produced

image

OS - Ubuntu 20.04 LTS

Installed packages

pip list                                                                                                            
Package         Version                                                                                                                                                                   
--------------- -------                                                                                                                                                                   
contourpy       1.0.5                                                                                                                                                                     
cycler          0.11.0                                                                                                                                                                    
fonttools       4.25.0                                                                                                                                                                    
Jinja2          3.1.2                                                                                                                                                                     
kiwisolver      1.4.4                                                                                                                                                                     
MarkupSafe      2.1.1                                                                                                                                                                     
matplotlib      3.8.0                                                                                                                                                                     
numpy           1.26.0                                                                                                                                                                    
packaging       23.1                                                                                                                                                                      
Pillow          10.0.1                                                                                                                                                                    
pip             23.3                                                                                                                                                                      
pyparsing       3.0.9                                                                                                                                                                     
pysam           0.22.0                                                                                                                                                                    
python-dateutil 2.8.2                                                                                                                                                                     
samplot         1.3.1                                                                                                                                                                     
setuptools      68.0.0                                                                                                                                                                    
six             1.16.0                                                                                                                                                                    
wget            3.2                                                                                                                                                                       
wheel           0.41.2
Adoni5 commented

Downgrading matplotlib fixes this issue - I chose 3.6.0 at random, and the ticks were fixed

image

I can confirm that the problem goes away when downgrading matplotlib. Note that also the borders (black lines) around the plot go away.

$pip list
$conda list
$pip uninstall matplotlib
$pip install --force-reinstall matplotlib==3.6.0