How can I make a gradient background for a graphics box in Mathematica? -


i have seen answer problem plots, want general graphics box.

graphics[{disk[], red, rectangle[{-.75, 1}, {.5, -.5}]},   background -> green] 

i make background of graphic resemble 1 of color palette gradients. ideally type "rainbowcolors" somewhere in code , background rainbowcolors palette.

i remove background , make rectangle gradient fill, it's not i'd like. i'm hoping has beautiful bit of knowledge.

thanks much!!

the closest aware of combination of prolog, polygon, vertexcolors, , scaled coordinates:

graphics[  {disk[], red, rectangle[{-.75, 1}, {.5, -.5}]},  prolog ->   polygon[    scaled /@ {{0, 0}, {0, 1}, {1, 1}, {1, 0}},    vertexcolors -> {yellow, green, magenta, pink}   ] ] 

enter image description here

more complicated gradients can formed stacking polygons:

graphics[  {disk[], red, rectangle[{-.75, 1}, {.5, -.5}]},  prolog ->   {polygon[     scaled /@ {{0, 0}, {0, 1/2}, {1, 1/2}, {1, 0}},     vertexcolors -> {red, yellow, pink, blue}    ],    polygon[     scaled /@ {{0, 1/2}, {0, 1}, {1, 1}, {1, 1/2}},     vertexcolors -> {yellow, green, magenta, pink}    ]} ] 

enter image description here

if struggle turning function let me know had trouble , try help.


please ask future questions on dedicated mathematica stackexchange site:

enter image description here


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -