Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is this dynamic plot possible with mathematica?

Here is a BBC dynamic graphics. I am thinking it might be possible to reproduce the graphics in Mathematica.

enter image description here

In the process of answering we will see some charming graphics tricks available in MMA. That is the only reason to ask the question out here.

Update:

I just checked that BBC is using simple JavaScript to do it. They have manually made the static pictures and not even using Flash based event handling. So all the pictures are static entities and once we click on one country it generates a unique image. For other countries it shows other images. The separate images for each cases can be generated via PowerPoint, Visio or even Photoshop. One can check this just by disabling the JavaScript in your browser and by reloading the page.

I understand that those single pictures can be made from MMA. Some answers shows the right direction how one can do it. So I am accepting the best answer that has come so far.

like image 362
PlatoManiac Avatar asked Nov 19 '11 10:11

PlatoManiac


1 Answers

Some more basic footwork for this:

g[\[Alpha]_, \[Beta]_, color_] := Module[{t},
 t = Graphics[{{Thickness[.03], Arrowheads[{.15}], color,
  Arrow[
   BezierCurve[{{Cos[\[Alpha]], Sin[\[Alpha]]}, {0, 
      0}, {Cos[\[Beta]], Sin[\[Beta]]}}]]}},
PlotRange -> 1.5, ImageSize -> 512, Background -> None];
ImageCompose[Blur[t, 15], t]
]

one = Fold[ImageCompose, 
 g[0, \[Pi]/3, Blue], {g[0, \[Pi]/2, Blue], g[0, \[Pi], Blue], 
 g[0, 4 \[Pi]/3, Blue]}]

two = Fold[ImageCompose, 
 g[\[Pi]/3, 0, Yellow], {g[\[Pi]/3, \[Pi]/2, Yellow], 
 g[\[Pi]/3, \[Pi], Yellow], g[\[Pi]/3, 4 \[Pi]/3, Yellow]}]

DynamicModule[{pick = 1},
 ClickPane[
  Dynamic@If[pick == 1, one, two],
  Function[{point}, If[First[point] < 256, pick = 1, pick = 2]]]
 ]

enter image description here

like image 72
Arnoud Buzing Avatar answered Sep 23 '22 02:09

Arnoud Buzing