sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.45k stars 481 forks source link

fix elliptic curve plot legends #18711

Open kcrisman opened 9 years ago

kcrisman commented 9 years ago
sage: Qx.<x>=PolynomialRing(QQ)
sage: K.<a> = NumberField(x^2-2)
sage: S = K.embeddings(RR)
sage: E=EllipticCurve([a,0])
sage: F = E.base_extend(S[0])
sage: F.plot(legend_label='b')
Launched png viewer for Graphics object consisting of 2 graphics primitives

The legend label appears twice, because

sage: F.plot??
...
        for j in range(len(I)):
            a,b,shape = I[j]
            v = generate_plot_points(f1, (a, b), plot_points, adaptive_tolerance, adaptive_recursion, randomize)
            w = generate_plot_points(f2, (a, b), plot_points, adaptive_tolerance, adaptive_recursion, randomize)
            if shape == 'o':
                g += plot.line(v + list(reversed(w)) + [v[0]], **args)
            elif shape == '<':
                g += plot.line(list(reversed(v)) + w, **args)
            elif shape == '>':
                g += plot.line(v + list(reversed(w)), **args)
            else:
                g += plot.line(v, **args)
                g += plot.line(w, **args)
        return g

Component: graphics

Issue created by migration from https://trac.sagemath.org/ticket/18711

kcrisman commented 9 years ago
comment:1

One could monkey in a solution for legend stuff but in truth there are a lot of legend options and so it would be better to have a cleaner solution, such as one that did the plots first and then passed in keyword arguments, if that were possible.

0a4abc94-1dd1-4ad8-9026-8909fdd5b544 commented 7 years ago

Attachment: sage_bug_18711.png

Image showing the duplicate legend_label

0a4abc94-1dd1-4ad8-9026-8909fdd5b544 commented 7 years ago
comment:2

Ticket #23063 might be a duplicate.