Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Primitive Disk Gradient Fills in Graphics

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110962] Re: Primitive Disk Gradient Fills in Graphics
  • From: "David Park" <djmpark at comcast.net>
  • Date: Wed, 14 Jul 2010 05:36:17 -0400 (EDT)

Here is a solution using Presentations. You should also be able to do this
using RegionPlot, Show and some graphics level jumping.

Needs["Presentations`Master`"] 

gradientDisk::usage = 
  "gradientDisk[{xcenter, ycenter}, radius, color] will draw an \
outlined colored disk with the color blended from White to full color \
across the the horizontal dimension.";
SyntaxInformation[
   gradientDisk] = {"ArgumentsPattern" -> {{_, _}, _, _}};
gradientDisk[{xcenter_, ycenter_}, radius_, color_] :=
 {RegionDraw[(x - xcenter)^2 + (y - ycenter)^2 < radius^2, {x, 
    xcenter - radius, xcenter + radius}, {y, ycenter - radius, 
    ycenter + radius},
   ColorFunctionScaling -> False,
   ColorFunction -> 
    Function[{x, y}, 
     Blend[{White, color}, 
      Rescale[x, {xcenter - radius, xcenter + radius}]]]],
  AbsoluteThickness[1],
  Circle[{xcenter, ycenter}, radius]} 

Draw2D[
 {gradientDisk[{0, 0}, 1, Red],
  gradientDisk[{2, 2}, 1/2, Green],
  gradientDisk[{-2, 1}, .45, Blue]},
 Frame -> True,
 PlotRange -> 4
 ] 


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  



From: Murta [mailto:rodrigomurtax at gmail.com] 

Hello All

   There is really no way to do a simple gradient fill inside a disk
in Mathematica?
   I'm working in a BubbleChart, and would like to make a graphics
disk using ChartElements, going to color x to transparent using
opacity.
   I get surprised to see that there is no way to work with gradient
fill inside primitives like Disk.. there is really this?
   If it's true, please, correct it in Mathematica 8!...




  • Prev by Date: Re: Simplest way to get 2 digits from an integer...
  • Next by Date: Templates from Usage Messages
  • Previous by thread: Primitive Disk Gradient Fills in Graphics
  • Next by thread: File names and strings