Skip to content
Snippets Groups Projects

Remove linewidth keyword argument from PP-plot legend

Merged Michael Williams requested to merge michael.williams/bilby:fix_pp_plot_legend into master

make_pp_plot currently returns an error because of the linewidth keyword argument in the legend:

File "make_pp_plots.py", line 19, in main
    make_pp_plot(results)
  File "/home/michael/git_repos/bilby/bilby/core/utils.py", line 1202, in wrapper_decorator
    value = func(*args, **kwargs)
  File "/home/michael/git_repos/bilby/bilby/core/result.py", line 1887, in make_pp_plot
    ax.legend(linewidth=1, handlelength=2, labelspacing=0.25, fontsize=legend_fontsize)
  File "/home/michael/.miniconda3/envs/pytorch/lib/python3.7/site-packages/matplotlib/axes/_axes.py", line 406, in legend
    self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)

This isn't a supported keyword argument in matplotlib.legend (see: https://github.com/matplotlib/matplotlib/blob/a1a5298b0d4a8d8230103d0fa8d369fca7fdeea0/lib/matplotlib/legend.py#L283).

Since the default matplotlib line width is one anyway, this merge request just removes it. Though further changes could be made to ensure the line width is always one even if the user changes plotted line width with the kwargs parsed to plt.plot here

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading