On 10/28/11 12:15 PM, kcrisman wrote:


On Oct 27, 8:09 pm, Jason Grout<jason-s...@creativetrax.com>  wrote:
On 10/27/11 6:51 PM, Eric Kangas wrote:

Hi,

I am working on a standard plot function for multiple plots. I would
like to have each plot in a different color to distinguish each
function, and also able to show a legend with the color, and function.

Here is what I have right now:

plot([derivative((f(x), a) for a in [0,1,..3]], (x,0,2*pi), color = ())

Try something like:

colors=rainbow(len([0,1,..3]))
sum(plot(derivative((f(x), a) , (x,0,2*pi), color =
colors[i],label="Plot %d"%i) for i,a in enumerate([0,1,..3]))

Make each curve an individual plot, and then sum them together.

Though for years I've wanted to do

plot([f,g,h],(x,0,1),color=['red','blue','green'])

Don't know how hard it would be to send color to list and check if it
had the right length...  probably not?

Almost surely it's not hard. My guess is that it would involve maybe one or two lines of code change, right at the start where it detects if you have multiple functions and calls plot for each function.

That's around line 3216 of plot/plot.py, right after this comment:

    #check to see if funcs is a list of functions that will
    #be all plotted together.

It already tries to be smart and pick a rainbow of colors if you want filling.

Thanks,

Jason



--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to