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} ] ]
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} ]} ]
if struggle turning function let me know had trouble , try help.
please ask future questions on dedicated mathematica stackexchange site:
Comments
Post a Comment