Ask Your Question

Raul's profile - activity

2018-07-26 13:58:32 -0500 received badge  Notable Question (source)
2018-07-26 13:58:32 -0500 received badge  Popular Question (source)
2017-04-15 15:25:46 -0500 received badge  Notable Question (source)
2016-08-31 14:41:17 -0500 received badge  Popular Question (source)
2016-02-22 09:50:38 -0500 received badge  Famous Question (source)
2015-01-14 04:04:24 -0500 received badge  Popular Question (source)
2015-01-14 04:04:24 -0500 received badge  Notable Question (source)
2014-05-09 15:01:43 -0500 marked best answer Controling the color of a parametric surface.

Hi. If I understand correctly, your question is related to this section of the Sage Trac (colormaps on implicit and parametric plots):

http://trac.sagemath.org/ticket/12212

It seems that the feature still requires some work.

2014-05-01 15:19:57 -0500 commented question Controling the color of a parametric surface.

@niles: I have seen that link before, but thanks for sharing it anyway. What I want is a little more complex than that I think. I want the colors to represent the values of a complex-valued function defined on a parametric surface. I don't really know how to adapt the answer given in that thread to achieve what I want. Maybe you have some ideas?

2014-05-01 15:17:27 -0500 commented answer Controling the color of a parametric surface.

I see, thank you for the link. I guess I should have to look for some workaround in the meantime.

2014-04-29 15:59:43 -0500 commented question Controling the color of a parametric surface.

I guess I'm looking for something that looks like the following picture: http://mailinglists.scilab.org/Plotting-functions-of-spherical-coordinates-on-a-sphere-td4025441.html

2014-04-29 15:48:30 -0500 asked a question Controling the color of a parametric surface.

I would like to represent a complex valued function on a parametric surface. I know that the complex_plot function can represent a complex function using colors. Is there a way of using it to color parametric surfaces? In other words, can I define the colors of the points of a parametric surface in terms of the two parameters in a natural and easy way?

2014-04-29 06:59:02 -0500 marked best answer How can I Change the background color of a plot.

Using PIL offers a further way. PIL is included in Sage.

def show_bg(gobj,bgcolor=(100,200,200),**kwargs):
    """
    add background color to a transparent plot

    gobj         any 2D graphics object created with option transparent=True
    bgcolor      tuple  (r,g,b) r,g,b in range 0..255
                 or string with proper color name 
    kwargs       all other keyword args are passed to save    

    EXAMPLES:
    sage: P = plot(sin,-pi,pi,color='red',thickness=2,transparent=True)
    sage: P += parametric_plot((2*x,x),(x,-2,2),color='gold',thickness=3)
    sage: show_bg(P,aspect_ratio=3/2,figsize=5,bgcolor='mistyrose')

    """

    # create temp file in DATA folder of this worksheet
    gobj.save(DATA+'tmp_plot.png',**kwargs)

    from PIL import Image
    im = Image.open('./data/tmp_plot.png')

    # create background file of same size and given bgcolor    
    bg = Image.new('RGB',im.size,bgcolor)

    # paste im into bg using im as mask
    bg.paste(im,(0,0),im)
    bg.save('output.png')
2014-04-29 06:59:02 -0500 received badge  Scholar (source)
2014-04-29 06:57:28 -0500 commented answer How can I Change the background color of a plot.

@ndomes: Thanks a lot! It works pretty nice now!

2014-04-28 03:57:22 -0500 received badge  Nice Question (source)
2014-04-27 08:57:10 -0500 received badge  Supporter (source)
2014-04-27 08:55:48 -0500 commented answer How can I Change the background color of a plot.

I tried to use your example in green, but I got this answer: File "/tmp/tmpGDjbwd/___code___.py", line 5, in <module> show_bg(P,aspect_ratio=_sage_const_3 /_sage_const_2 ,figsize=_sage_const_5 ,bgcolor='mistyrose') NameError: name 'show_bg' is not defined I guess I should include some package before using this?

2014-04-25 14:21:56 -0500 received badge  Student (source)
2014-04-25 07:21:00 -0500 asked a question How can I Change the background color of a plot.

I want to create some plots using sage to then save them in my computer. I don't want the background to be white (or transparent). Is there a way of specifying the background of a plot inside sage?

(I'm looking for an option of the form:

sage: t=var('t')

sage: p=parametric_plot((t,2*t), (t, -5, 5))

sage: p.show(background=(.1,.2,.3))

or something like that.)

2014-02-19 11:07:51 -0500 received badge  Teacher (source)
2014-02-19 11:07:51 -0500 received badge  Self-Learner (source)
2013-10-17 08:23:39 -0500 asked a question complex plot spherical harmonics

I want to plot spherical harmonics in the following way: I want to describe the spheres using implicit 3d plot, and then color each point of the sphere to represent the complex value it takes, just as complex plot does it.

I found this question that is related to my problem, but it seems like it has no solution as of yet:

http://ask.sagemath.org/question/17/u...

Any idea about what to do?

2013-04-01 07:37:31 -0500 received badge  Editor (source)
2013-04-01 07:36:00 -0500 answered a question Dancing x-axis in animation [solved]

I just found out how to solve the problem, I just changed the first command to

a = animate([sin(20*(x - float(k)))/x for k in srange(0,2*pi,0.5)], 
           xmin=1, xmax=4, ymin=-1, ymax=1)

Please disregard the question.

2013-04-01 07:29:49 -0500 asked a question Dancing x-axis in animation [solved]

I'm very new to sage, and I'm trying to make the following animation:

a = animate([sin(20*(x - float(k)))/x for k in srange(0,2*pi,0.5)], 
           xmin=1, xmax=4, figsize=[3,2])
a.gif(savefile='my_animation.gif', show_path=True)

The problem is that if you look at the animation you'll notice that the x-axis is moving all the time which I find very distracting. Is there a way to tell sage that I want to center the x-axis, so that it stops moving with the animation?