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: [mg110984] Re: Primitive Disk Gradient Fills in Graphics
  • From: "David Park" <djmpark at comcast.net>
  • Date: Fri, 16 Jul 2010 05:15:24 -0400 (EDT)

Many thanks for that Patrick.

I don't think one has to Unprotect ChartElementData. At least, I had no
problem. Here is an example of getting out these primitives and using them
in your own custom plot.

The possible types of primitives for BubbleChart:

ChartElementData["BubbleChart"] 

{"Bubble", "FadingBubble", "GradientBubble", "MarkerBubble", \
"NoiseBubble", "OscillatingBubble", "PolyhedronBubble", \
"SphereBubble", "SquareWaveBubble", "TriangleWaveBubble"} 

Examine one of these with Manipulate.

ChartElementData["SquareWaveBubble", "Manipulate"] 

Insert a specific case to see the form of the function.

ChartElementDataFunction["SquareWaveBubble", "AngularFrequency" -> 20,
  "RadialAmplitude" -> 0.1`] 

Now design a custom primitive. This one specifies the location, size and
color for a SquareWaveBubble. The RadialAmplitude varies with the size.
(Look up ChartElementFunction for more details.)

myBubble[x_, y_, size_, color_] := {color, 
  ChartElementDataFunction["SquareWaveBubble", 
    "AngularFrequency" -> 20, 
    "RadialAmplitude" :> Rescale[size, {.2, 3}, {1, 0}]][{{x - size/2,
      x + size/2}, {y - size/2, y + size/2}}, {x, y}]} 

Here is some data and a plot done outside of BubbleChart.

data = Table[{RandomReal[{-10, 10}], RandomReal[{-10, 10}], 
    s = RandomReal[{.2, 3}], 
    ColorData["DarkRainbow"][Rescale[s, {.2, 3}]]}, {i, 15}];
Graphics[
 {myBubble @@@ data},
 AspectRatio -> Automatic,
 Frame -> True,
 PlotRange -> 13] 

However, this does depend on having an Automatic AspectRatio.

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











From: Patrick Scheibe [mailto:pscheibe at trm.uni-leipzig.de] 

Hi all,

just clear the protection attributes of ChartElementData and find out
that

ChartElementData["GradientBubble", "Manipulate"]

should help.

Cheers
Patrick

On Thu, 2010-07-15 at 03:10 -0400, David Park wrote:
> 
> Also, since WRI must have defined a primitive for SquareWaveBubble, say,
how
> could we obtain direct access to it? (I know how to program one but since
> WRI has done, and buried, the work how about getting it out?)
> 
> 
> David Park
> djmpark at comcast.net
> http://home.comcast.net/~djmpark/  
> 



  • Prev by Date: Re: Primitive Disk Gradient Fills in Graphics
  • Next by Date: Re: Fast pricer for American options
  • Previous by thread: Re: Primitive Disk Gradient Fills in Graphics
  • Next by thread: Re: Primitive Disk Gradient Fills in Graphics