1
|
5858 Views
|
4 Replies
|
6 Total Likes
View groups...
Share

# Color Gradients Across a Circle

Posted 11 years ago
 Hi All,I would like to make a Disk with more than one color on it. Right now I've got:n = 100;Graphics[Table[{ColorData["GrayYellowTones"][i/n],    Disk[{0, 0}, (i/n + .5)]}, {i, n, 1, -1}]]which produces the following image . I would like to do this in a smarter way so I don't have to draw loads of circles.Any suggestions? Thanks!
4 Replies
Sort By:
Posted 11 years ago
 It is actually quite interesting. Mathematica is really flexible. The different pieces of code in the question and in all three replies tell the same story but with very different words! Beautiful, isn't it?M.
Posted 11 years ago
 Hi Cesar,this is not elegant, but the problem is that Disk does apparently not allow for textures. But this works: img = Rasterize[  DensityPlot[x, {x, -4, 4}, {y, -4, 4}, ColorFunction -> "Rainbow",    Frame -> False, PlotRangePadding -> None]];ParametricPlot[{r*Cos[t], r*Sin[t]}, {r, 0, 1}, {t, 0, 2 Pi}, Mesh -> False, BoundaryStyle -> None, Axes -> False, Frame -> False, PlotStyle -> {Opacity[1], Texture[img]}]This is the result:The code is longer than yours, but this allows easily to use any image as texture and the idea is quite simple. If you use yellowtones instead it looks like that:With other textures one can get:ParametricPlot[{r*Cos[t], r*Sin[t]}, {r, 0, 1}, {t, 0, 2 Pi}, Mesh -> False, BoundaryStyle -> None, Axes -> False, Frame -> False, PlotStyle -> {Opacity[1],    Texture[ExampleData[{"ColorTexture", "WhiteMarble"}]]}]M.
Posted 11 years ago