# How can I change background color of plot in maple?

a := x^3+x^2-x;
b := 20*sin(x^2)-5;


and I would like to change a background color and fill the areas between two curves. I filled areas but I dont know how can I change the background, any idea?

plots[display]([plottools[transform]((x, y)->
[x, y+x^3+x^2+x])(plot(20*sin(x^2)-5-
x^3-x^2-x, x = o .. s, filled = true, color = red)),
plot([x^3+x^2+x, 20*sin(x^2)-5],
x = -3 .. 3, y = -30 .. 30, color = black)]);

• What do you mean by Background? Do you mean the sheet you drew the curves or??? – mrs Jun 13 '13 at 18:35
• I mean background color...all color behind the curves and the color of areas between the curves – Lukas Jun 13 '13 at 18:46
• See the filled = true, color = red part? filled equaling true means you have a background, color = red means this background has color red, changing that will change the background color. – Shuhao Cao Jun 13 '13 at 18:59
• yes, but its background color between curves.i want background color except this area...now it is white – Lukas Jun 13 '13 at 19:05

The way in which @acer colored the area between two curves is really elegant, so I don't have any additional points about it for you. Just to say that: when you made the area between two curves colored (following the acer's way); I think the following line could make the background colored as well:

> plot([50, -50], x = -3 .. 3, y = -50 .. 50, filled = true, color = blue); One way is to add a colored rectangle to the displayed items. Note that the filled red region now gets transparency=0.0 so that the green doesn't bleed through it.

a := x^3+x^2-x:
b := 20*sin(x^2)-5:

plots[display](
plottools[transform]((x, y)-> [x, y+x^3+x^2+x])
(plot(20*sin(x^2)-5-x^3-x^2-x,
x = 0 .. 3, filled = true, color = red,
transparency=0.0)),
plot([x^3+x^2+x, 20*sin(x^2)-5],
x = -3 .. 3, y = -30 .. 30, color = black),
plottools:-rectangle([-3,-30],[3,40],colour=green)); And here is a version for those who will (often ill-advisedly) want to copy blocks of plaintext 1D Maple Notation code and paste it into a 2D Math input region.

H := plottools[transform](proc(x, y) [x, y+x^3+x^2+x]; end proc):
plots[display](H(plot(20*sin(x^2)-5-x^3-x^2-x,
x = 0 .. 3, filled = true, color = red,
transparency=0.0)),
plot([x^3+x^2+x, 20*sin(x^2)-5],
x = -3 .. 3, y = -30 .. 30, color = black),
plottools:-rectangle([-3,-30],[3,40],colour=green));


The 2D Math parser doesn't like the first version above since the formatted code involves extra spaces between the transform result and its bracketed arguments. A space in such a function call gets parsed in 2D Math mode as an implicit multiplication. All these parsing issues have nothing in particular to do with this solution, or with background colors on plots, or with plots[display].

• I use Maple13 and obtained the error message (too long for 1 comment) Error, (in plots:-display) expecting plot structure but received: proc (p) local p1, p2, z, d; if Plot:-Structure:-IsPlot(p) then if Plot:-Structure:-IsPlotArray(p) then error "cannot transform an array of plots" end if; p1 := [op(map(transform/object, p, proc (x, y) options operator, arrow; [x, y+x^3+x^2+x] end proc))]; – vesszabo Jun 14 '13 at 5:50
• if "NoUserValue" = "NoUserValue" then p2 := minus({op(map(Plot:-Structure:-GetDimension, p1))}, {FAIL}); if p2 = {2} then d := 2 elif p2 = {3} then d := 3 else try z := (proc (x, y) options operator, arrow; [x, y+x^3+x^2+x] end proc)(1., 1.); if type(z, 'list') then d := nops(z) else error end if catch: d := if(op(0, ... – vesszabo Jun 14 '13 at 5:51
• I posted plain text Maple notation code, which works fine as 1D Maple Notation code in Maple 13. It generates an error if you paste it in as if it were 2D Math input. Generally you cannot validly paste all valid 1D Maple Notation (plaintext) code in as 2D Math. In this case it is a 2D Math parser bug in Maple 13 which causes your error message. I will add a version using proc...end proc instead of right-arrow operator, so that you can run it even pasted in as a block of 2D Math input. – acer Jun 14 '13 at 6:22
• An edited code added to the response, which can be pasted in as a block of 2D Math. The problem was that the split like has spaces in a function call, between procedure reference and its bracketed arguments. In 2D Math that space makes it get interpreted as implicit multiplication instead of a function call. – acer Jun 14 '13 at 6:43
• Thanks for your extra effort (+1). Everything works well. – vesszabo Jun 14 '13 at 19:18

Thanks to @Babak S. and @acer $\Huge\color{green}{✔}^\color{red}{+}$

I Just wanted to say that:

Right click on the background color -> select "color" -> You can also use "the default colors". • :$\color{green}{+1}$ – M.H Jun 14 '13 at 18:35
• @Software: +1 ;-) – Namaste Jul 24 '13 at 17:46

Hmm, the closest thing I could find after a quick search on Maple Help was the ability to choose a colour between the curve and the x-axis. I don't know how helpful that would be to you though.

Alternatively, maybe you could try to make two plots- one your actual plot and the other a plot of solid colour for the background and use the display command to plot them on the same set of axes.