New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with sga-preqc-report.py: Invalid arguments to legend #98

Closed
reubwn opened this Issue Dec 10, 2015 · 8 comments

Comments

Projects
None yet
3 participants
@reubwn

reubwn commented Dec 10, 2015

Hi Jared,

First, thanks for the great piece of software :)

I'm having issues generating the preqc report PDF. I suspect it's something to do with matplotlib - I'm running:

SGA version 0.10.14
Matplotlib version 1.5

Error message:

>> sga-preqc-report.py genome.shuff.preqc 
output_pfx:  preqc_report
preqc_files:
genome.shuff.preqc
Traceback (most recent call last):
  File "/home/rnowell/software/sga/src/bin/sga-preqc-report.py", line 871, in <module>
    sys.exit(main(argv=None))
  File "/home/rnowell/software/sga/src/bin/sga-preqc-report.py", line 101, in main
    save_png=args.png, pylab_show=args.show)
  File "/home/rnowell/software/sga/src/bin/sga-preqc-report.py", line 764, in make_report_with_subplots
    plot_legend(subplots[2][0], data)
  File "/home/rnowell/software/sga/src/bin/sga-preqc-report.py", line 333, in plot_legend
    ax.legend(proxy_arts, names, 2, bbox_to_anchor=(0,1), borderaxespad=0.)
  File "/export131/home/rnowell/virt_env/python/sga/lib/python2.7/site-packages/matplotlib/axes/_axes.py", line 536, in legend
    raise TypeError('Invalid arguments to legend.')
TypeError: Invalid arguments to legend.

From previous experience (on a different machine), I know the input file works using matplotlib 1.4, however I am having trouble installing this older version on the cluster I'm using now as it requires a specific version of freetype2 (>= 2.4).

Is there a way to get sga-preqc-report.py to work with 1.5? Or another workaround for installing 1.4?

Many thanks for any advice,

Reuben

@jakevdp

This comment has been minimized.

Contributor

jakevdp commented Dec 10, 2015

I poked around through the git history: I suspect this is the commit that broke things: matplotlib/matplotlib@2bddb79 That's the only change to the code in 1.5 that I can see.

@jakevdp

This comment has been minimized.

Contributor

jakevdp commented Dec 10, 2015

Here's the relevant PR: matplotlib/matplotlib#3943

@jakevdp

This comment has been minimized.

Contributor

jakevdp commented Dec 10, 2015

I think the fix here is to explicitly pass the loc parameter; e.g. change

ax.legend(proxy_arts, names, 2, bbox_to_anchor=(0,1), borderaxespad=0.)

to

ax.legend(proxy_arts, names, loc=2, bbox_to_anchor=(0,1), borderaxespad=0.)
@reubwn

This comment has been minimized.

reubwn commented Dec 10, 2015

Bingo! You're a genius :)

Tested and works (generates PDF without problems) with SGA v0.10.14 and matplotlib v1.5. BTW, the line to fix is on line #333 of sga-preqc-report.py

Thanks!

@jakevdp

This comment has been minimized.

Contributor

jakevdp commented Dec 10, 2015

Great! Glad to help.

@jts

This comment has been minimized.

Owner

jts commented Dec 10, 2015

great! does this work on 1.4 as well? do you want to make a PR so your contribution is noted?

@jakevdp

This comment has been minimized.

Contributor

jakevdp commented Dec 10, 2015

Done in #99

@jts

This comment has been minimized.

Owner

jts commented Dec 10, 2015

Merged. Thanks!

@jts jts closed this Dec 10, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment