Apart for being a mouthful of a one-liner, what would be wrong with :
plot(sqrt(-x^2+2*abs(x))*sgn(-x),[x,-2,2] ,figsize=4,
      xmin=-2,  xmax=2, ymin=-2, ymax=2, aspect_ratio=1, axes=False,
      fill=-sqrt(4-x^2), color="black", fillcolor="black", fillalpha=1) +
plot(sqrt(-x^2+2*abs(x))*sgn(-x),[x,-2,2], figsize=4
             xmin=-2, xmax=2, ymin=-2, ymax=2, aspect_ratio=1, axes=False,
             fill=sqrt(4-x^2), color="red", fillcolor="red", fillalpha=1)
, pray tell me ?

Aand you don't have the to put up with the black border up the positive 
half circle that the draw2d solution plots. An implicit plot might be a 
better way to render this, BTW, but I dont' have it on the tips of my 
fingers right now....

Note : the "figsize=4" bit is for emacs' sage_mode sake. It looks nice'n 
smooth without it.

Since it's pure sage, it could be rendered even better in tikz ... if I 
could find a way to coax matplot to use its built-in interface to tikz. But 
the damn thing is quite opaque to me. Any idea ?

[ BTW : this (rendering via tikz) might be a nice enhancement for sagetex 
users... Hmmm... I'll have to dive in the source code. Not for now, alas... 
]

HTH,
--
Emmanuel Charpentier

Le mardi 25 mars 2014 09:50:38 UTC+1, HG a écrit :
>
>
>
> Hi, 
> I got this yin-yang from 
> http://riotorto.users.sourceforge.net/gnuplot/func2d/index.html (thanks 
> for it !) : 
>
> draw2d( 
>     proportional_axes = xy, 
>     title             = "Ying-Yang", 
>     ellipse(0,0,2,2,0,360), 
>     fill_color        = black, 
>     filled_func       = -sqrt(4-x^2), 
>     explicit(if x < 0 then sqrt(-x^2-2*x) else -sqrt(-x^2+2*x),x,-2,2) ) 
> $ 
>
>
> But I need it in sagemath to get it well embedd in texmacs. 
> After long trying I didn't not success, my main problem is conditions. 
> If a good soul could do it for me all my thanks. 
> Kind regards, 
> HG 
>
> I have done this which is not really good :
> y=sqrt(4-x^2);b=y
> r=sqrt(-x^2-2*x);q=-sqrt(-x^2+2*x)
> e=solve(b==r,y)
>
> c=plot(b,(y,-2,2),fill=True,fillcolor="black",color="black",figsize=3,aspect_ratio=1);
>
> c+=plot(r,(y,-2,2),fill=True,fillcolor="red",color="red",figsize=3,aspect_ratio=1)
>
> d=plot(-b,(y,-2,2),fill=True,fillcolor="red",color="red",figsize=3,aspect_ratio=1);
>
> d+=plot(-r,(y,-2,2),fill=True,fillcolor="red",color="red",figsize=3,aspect_ratio=1);
> p=plot(q,(y,-2,2),fill=True,fillcolor="red",color="red",figsize=3);
> p+=plot(q,(y,-2,2),fill=True,fillcolor="black",color="red",figsize=3)
> plot(c+d+p,figsize=2,aspect_ratio=1,axes=False)
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to