MathGroup Archive 2011

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

Search the Archive

Re: Venn diagrams?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118309] Re: Venn diagrams?
  • From: Mark McClure <mcmcclur at unca.edu>
  • Date: Thu, 21 Apr 2011 03:11:02 -0400 (EDT)

On Sun, Apr 17, 2011 at 7:54 AM, dantimatter <google at dantimatter.com> wrote:

> Is there a nice and easy way to make pretty Venn diagrams with
> Mathematica, where the areas of the circles and intersecting regions
> are to scale?

A student asked me how to *easily* generate Venn diagrams for a
presentation.  I'm actually fairly adept at generating various images
with Mathematica but was a bit busy and turned to Wolfram|Alpha.  The
results were pretty nice.  In V8, you might just try the following:

wa = WolframAlpha[
  "A intersect B union C intersect D",
   {{"VennDiagram", 1}, "Content"}]

This generates a nice picture.  Although I can't figure out a way to
get the code for the picture, you can manipulate it fairly easily.
Using this, I performed the following silliness:

g = Graphics @@ First[Cases[wa,
     _GraphicsBox, Infinity]];
g = DeleteCases[g, _InsetBox, Infinity];
pos = Position[g, _RGBColor, Infinity];
g = MapAt[ColorData["StarryNightColors"][0] &,
   g, pos[[{7}]]];
g = MapAt[ColorData["StarryNightColors"][1] &,
   g, pos[[{1, 4}]]];
g = MapAt[ColorData["StarryNightColors"][0.5] &,
  g, pos[[{2, 3, 5, 6}]]];
Show[g, ImageSize -> 500]


Of course, there's nothing like full programmatic control and I'm not
sure that this can meet your proportionality requirements.  But it's
pretty easy!

Mark McClure


  • Prev by Date: Re: trouble printing to PDF
  • Next by Date: Re: Solve vs. nonlinearity
  • Previous by thread: Re: Venn diagrams?
  • Next by thread: Re: Venn diagrams?