#13690: legend marker 'o' is incorrectly printed
----------------------------+-----------------------------------------------
Reporter: ppurka | Owner: jason, was
Type: defect | Status: new
Priority: major | Milestone: sage-5.5
Component: graphics | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: #13693 | Stopgaps:
----------------------------+-----------------------------------------------
Old description:
> Just look at the output of this command
> {{{
> list_plot(range(3), plotjoined=True, marker='o', legend_label='square
> here, circle there')
> }}}
> The marker in the legend should be a `o` but it is actually printed as a
> square. This seems to be a bug in Sage because I couldn't reproduce it in
> matplotlib. I tried the following two variants:
> {{{
> import matplotlib.pyplot as plt
> plt.plot(range(3), range(3), '-o')
> plt.legend('square here')
> plt.savefig('a.png')
> }}}
> {{{
> import matplotlib.lines as lines
> from matplotlib.figure import Figure
>
> options = {'marker': 'o'}
> p = lines.Line2D(range(3), range(3), **options)
> p.set_label('square here, circle there')
> figure=Figure()
> subplot = figure.add_subplot(111)
> subplot.add_line(p)
> subplot.legend()
> from matplotlib.backends.backend_agg import FigureCanvasAgg
> figure.set_canvas(FigureCanvasAgg(figure))
> figure.savefig('a.png')
> }}}
>
> The bug dates back to at least sage-4.7. That's the oldest precompiled
> version of sage I had around here.
New description:
Just look at the output of this command
{{{
list_plot(range(3), plotjoined=True, marker='o', legend_label='square
here, circle there')
}}}
The marker in the legend should be a `o` but it is actually printed as a
square. This seems to be a bug in Sage because I couldn't reproduce it in
matplotlib. I tried the following two variants:
{{{
import matplotlib.pyplot as plt
plt.plot(range(3), range(3), '-o')
plt.legend('square here')
plt.savefig('a.png')
}}}
{{{
import matplotlib.lines as lines
from matplotlib.figure import Figure
options = {'marker': 'o'}
p = lines.Line2D(range(3), range(3), **options)
p.set_label('square here, circle there')
figure=Figure()
subplot = figure.add_subplot(111)
subplot.add_line(p)
subplot.legend()
from matplotlib.backends.backend_agg import FigureCanvasAgg
figure.set_canvas(FigureCanvasAgg(figure))
figure.savefig('a.png')
}}}
The bug dates back to at least sage-4.7. That's the oldest precompiled
version of sage I had around here.
----
Attached patch contains a test to the `line()` function.
Apply [attachment:trac_13690-legend_test_for_line.patch] to `devel/sage`.
--
Comment (by ppurka):
Replying to [comment:9 kcrisman]:
> I assume we should put something in a `TESTS` block somewhere then for
this ticket? In the sense that we could ask someone to visually confirm
the output, not that we are actually comparing images.
You are right. I attached a patch.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13690#comment:10>
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.