Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hello, everybody. I found a solution a few days after asking this question, but I couldn't post it until now. When we write

p = plot(x^2) + plot(x^3)

Sage creates a list of two "line groups". For example, if we write p[0], Sage answers something like "Line defined by 223 points". This is actually the set of points that define the curve for $x^2$. Similarly, p[1] is the set of points for $x^3$ .

Now, we can access the options associated with each line set with

p[i].options()

where i=0 or i=1 in this case. We will receive ans answer like

{'alpha': 1, 'legend_color': None, 'legend_label': None, 'rgbcolor': (0, 0, 1), 'thickness': 1}

As we can see, there is a field called "rgbcolor", which has a triplet associated. We can change that with any values we want, and use the set_options command to set the new configurations. (There are other properties that can be manually changed.)

Next, I give an example of how to change the color of the second graph ($x^3$) to green:

p = plot(x^2) + plot(x^3)
for plt in p:
    opt = plt.options()
    opt['regbcolor'] = Color('green')
    p.set_options(opt)

I hope this helps to whoever needs to change colors (or other attributes) AFTER calling plot.

Hello, everybody. I found a solution a few days after asking this question, but I couldn't post it until now. When we write

p = plot(x^2) + plot(x^3)

Sage creates a list of two "line groups". For example, if we write p[0], Sage answers something like "Line defined by 223 points". This is actually the set of points that define the curve for $x^2$. Similarly, p[1] is the set of points for $x^3$ .

Now, we can access the options associated with each line set with

p[i].options()

where i=0 or i=1 in this case. We will receive ans answer like

{'alpha': 1, 'legend_color': None, 'legend_label': None, 'rgbcolor': (0, 0, 1), 'thickness': 1}

As we can see, there is a field called "rgbcolor", which has a triplet associated. We can change that with any values we want, and use the set_options command to set the new configurations. (There are other properties that can be manually changed.)

Next, I give an example of how to change the color of the second graph ($x^3$) to green:

p = plot(x^2) + plot(x^3)
for plt in p:
    opt = plt.options()
    opt['regbcolor'] opt['rgbcolor'] = Color('green')
    p.set_options(opt)

I hope this helps to whoever needs to change colors (or other attributes) AFTER calling plot.

Hello, everybody. I found a solution a few days after asking this question, but I couldn't post it until now. When we write

p = plot(x^2) + plot(x^3)

Sage creates a list of two "line groups". For example, if we write p[0], Sage answers something like "Line defined by 223 points". This is actually the set of points that define the curve for $x^2$. Similarly, p[1] is the set of points for $x^3$ .

Now, we can access the options associated with each line set with

p[i].options()

where i=0 or i=1 in this case. We will receive ans an answer like

{'alpha': 1, 'legend_color': None, 'legend_label': None, 'rgbcolor': (0, 0, 1), 'thickness': 1}

As we can see, there is a field called "rgbcolor", which has a triplet associated. We can change that with any values we want, and use the set_options command to set the new configurations. (There are other properties that can be manually changed.)

Next, I give an example of how to change the color of the second graph ($x^3$) both function graphs to green:

p = plot(x^2) + plot(x^3)
for plt in p:
    opt = plt.options()
    opt['rgbcolor'] = Color('green')
    p.set_options(opt)
plt.set_options(opt)

I hope this helps to whoever needs to change colors (or other attributes) AFTER calling plot.