ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 30 Sep 2016 14:58:10 +0200Is it possible to embed a plot (or png) within another plot?https://ask.sagemath.org/question/34998/is-it-possible-to-embed-a-plot-or-png-within-another-plot/I have looked at the documentation for 2d plots without any success. I would like to know if it is possible to embed a plot within a plot.
I currently have a set of polygons and I would like to have plots of graphs embedded into each region. Something resembling the attached [image](/upfiles/14752402076305906.png).
Is it possible to achieve this using sagemath's plotting interface?
Thanks!fidbcFri, 30 Sep 2016 14:58:10 +0200https://ask.sagemath.org/question/34998/Plotting a 2d functionhttps://ask.sagemath.org/question/25122/plotting-a-2d-function/This should be easy, I want to make a nice colour plot of a 2d function where colour denotes the function value.
I can do
> y=var('y')
> f=y^2
> plot(f)
and I get a nice plot.
If I try
> y=var('y')
> f=y^2+x^2
> plot(f)
Then sage tells me it can't find the variable y. Which is ridiculous, since y is in the same place as when I tried to plot a 1d function of y. Anyway, I tried googling to find a function within sage to achieve this (without resorting to excessive matplotlib syntax) and had no success so thought I'd ask a question here. Intuitively, the second case is hardly more complicated than the former so there should be a simple function that can realize this for me.
Many thanks!DarwinThu, 04 Dec 2014 17:53:03 +0100https://ask.sagemath.org/question/25122/interpolated 2D plothttps://ask.sagemath.org/question/8471/interpolated-2d-plot/ Hello!
Is there a way to create a plot from a list of data using some kind of non-linear interpolation (e.g. splines) between the data points?
Thanks.v_2eMon, 14 Nov 2011 17:10:36 +0100https://ask.sagemath.org/question/8471/2D plot performancehttps://ask.sagemath.org/question/8420/2d-plot-performance/I have this function
sage: f=imag(I*(sqrt(-cos(l) + 1)*cosh(sin(1/2*l)) -
sqrt(2)*sinh(sqrt(sin(1/2*l)^2)))*sin(1/2*l)^3/((-cos(l)
+ 1)^(3/2)*e^(1/2*I*l)))
i.m.h.o. this not something terribly complicated. I wanted to plot it. So I do
sage: time plot(f,l,0,10)
..nice plot..
Time: CPU 9.28 s, Wall: 9.41 s
**I.e. I was waiting almost 10s** for this (on an intel core duo CPU P9500 @ 2.53GHz) laptop!? I thought that maybe `fast_callable` would help:
sage: ff=fast_callable(f,vars=[l],domain=CC)
sage: time plot(ff,0,10)
..same nice plot..
Time: CPU 13.24 s, Wall: 13.50 s
So that's even worse.
Now I compare to *Mathematica*
In[8]:= Timing[Plot[Im[(Sin[l/2]^3*(I*Sqrt[1 - Cos[l]]*Cosh[Sin[l/2]] -
I*Sqrt[2]*Sinh[Sqrt[Sin[l/2]^2]]))/(E^((I/2)*l)*(1 -
Cos[l])^(3/2))], {l, 0, 10}]]
Out[8]= {0.019997, ..same plot again..}
**~500 times faster** ... what am I doing wrong?XaverThu, 27 Oct 2011 16:57:58 +0200https://ask.sagemath.org/question/8420/