#12960: legend not properly set in Graphics().matplotlib()
-------------------------------------+--------------------------------------
Reporter: ppurka | Owner: jason, was
Type: defect | Status: needs_review
Priority: major | Milestone: sage-5.1
Component: graphics | Resolution:
Keywords: legend matplotlib | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
-------------------------------------+--------------------------------------
Changes (by ppurka):
* status: needs_work => needs_review
* work_issues: check show_legend =>
Old description:
> Bug :) Should be easy to fix.
> {{{
> sage: q = plot(x, legend_label='aha')
> sage: q.legend(True)
> sage: qm = q.matplotlib()
> ---------------------------------------------------------------------------
> KeyError Traceback (most recent call
> last)
>
> /home/punarbasu/Installations/sage-5.0.rc0.11080/devel/sage-main/<ipython
> console> in <module>()
>
> /home/punarbasu/Installations/sage-5.0.rc0.11080/local/lib/python2.7
> /site-packages/sage/plot/graphics.pyc in matplotlib(self, filename, xmin,
> xmax, ymin, ymax, figsize, figure, sub, axes, axes_labels, fontsize,
> frame, verify, aspect_ratio, gridlines, gridlinesstyle, vgridlinesstyle,
> hgridlinesstyle, show_legend, legend_options, axes_pad, ticks_integer,
> tick_formatter, ticks)
> 1714 lopts.update(legend_options)
> 1715 lopts.update(self._legend_opts)
> -> 1716 prop =
> FontProperties(family=lopts.pop('font_family'),
> weight=lopts.pop('font_weight'), \
> 1717 size=lopts.pop('font_size'),
> style=lopts.pop('font_style'), variant=lopts.pop('font_variant'))
> 1718 color = lopts.pop('back_color')
>
> KeyError: 'font_family'
> sage:
> }}}
> ----
> Apply [attachment:trac_12960-fix_legend.patch] to `devel/sage`
New description:
Bug :) Should be easy to fix.
{{{
sage: q = plot(x, legend_label='aha')
sage: q.legend(True)
sage: qm = q.matplotlib()
---------------------------------------------------------------------------
KeyError Traceback (most recent call
last)
/home/punarbasu/Installations/sage-5.0.rc0.11080/devel/sage-main/<ipython
console> in <module>()
/home/punarbasu/Installations/sage-5.0.rc0.11080/local/lib/python2.7/site-
packages/sage/plot/graphics.pyc in matplotlib(self, filename, xmin, xmax,
ymin, ymax, figsize, figure, sub, axes, axes_labels, fontsize, frame,
verify, aspect_ratio, gridlines, gridlinesstyle, vgridlinesstyle,
hgridlinesstyle, show_legend, legend_options, axes_pad, ticks_integer,
tick_formatter, ticks)
1714 lopts.update(legend_options)
1715 lopts.update(self._legend_opts)
-> 1716 prop = FontProperties(family=lopts.pop('font_family'),
weight=lopts.pop('font_weight'), \
1717 size=lopts.pop('font_size'),
style=lopts.pop('font_style'), variant=lopts.pop('font_variant'))
1718 color = lopts.pop('back_color')
KeyError: 'font_family'
sage:
}}}
----
Apply [attachment:trac_12960-fix_legend.2.patch] to `devel/sage`
--
Comment:
Ok. This is a much better fix since it takes care of all cases, for
example if you pass an incomplete set of options in the `legend={}`
argument, set `show_legend=True`, etc.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12960#comment:6>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.