Preface
This is a tutorial made solely for the purpose of education and it was designed for students taking Applied Math 0330. It is primarily for students who have very little experience or have never used Mathematica before and would like to learn more of the basics for this computer algebra system. As a friendly reminder, don't forget to clear variables in use and/or the kernel.
Finally, the commands in this tutorial are all written in bold black font, while Mathematica output is in regular fonts. This means that you can copy and paste all comamnds into Mathematica, change the parameters and run them. You, as the user, are free to use the scripts to your needs for learning how to use the Mathematica program, and have the right to distribute this tutorial and refer to this tutorial as long as this tutorial is accredited appropriately.
Return to computing page for the second course APMA0340
Return to Mathematica tutorial for the second course APMA0330
Return to Mathematica tutorial for the first course APMA0340
Return to the main page for the course APMA0340
Return to the main page for the course APMA0330
Return to Part I of the course APMA0330
Plotting with filling
1.1.6. Plots with Filling
We repeat the previous example with filling:









Filling -> Axis, FillingStyle -> Blue, Axes -> True, AxesStyle -> Directive[Thick]]
a = Graphics[{{Opacity[0], White, tr[[1]]}, GeometricTransformation[{Opacity[1], Blue, tr[[1]]}, TranslationTransform[{0, 1}]]}]
Show[a, Axes -> True, AxesStyle -> Black, AspectRatio -> 0.75]

FrameTicksStyle -> Directive[FontOpacity -> 0, FontSize -> 0]]




Graphics[{RGBColor[0.3, 0.5, 1], EdgeForm[Thickness[0.01]], poly}]


I. Venn Diagrams
Filling circles can be plotted using Graphics cammand. Graphics are represented as symbolic expressions, using
either"directives" or "styles":


We can plot Venn diagrams using the following subroutine
VennDiagram2[n_, ineqs_: {}] :=
Module[{i, r = .6, R = 1, v, grouprules, x, y, x1, x2, y1, y2, ve},
v = Table[Circle[r {Cos[#], Sin[#]} &[2 Pi (i - 1)/n], R], {i, n}];
{x1, x2} = {Min[#], Max[#]} &[
Flatten@Replace[v,
Circle[{xx_, yy_}, rr_] :> {xx - rr, xx + rr}, {1}]];
{y1, y2} = {Min[#], Max[#]} &[
Flatten@Replace[v,
Circle[{xx_, yy_}, rr_] :> {yy - rr, yy + rr}, {1}]];
ve[x_, y_, i_] :=
v[[i]] /. Circle[{xx_, yy_}, rr_] :> (x - xx)^2 + (y - yy)^2 < rr^2;
grouprules[x_, y_] =
ineqs /.
Table[With[{is = i}, Subscript[_, is] :> ve[x, y, is]], {i, n}];
Show[If[MatchQ[ineqs, {} | False], {},
RegionPlot[grouprules[x, y], {x, x1, x2}, {y, y1, y2},
Axes -> False]],
Graphics[v],
PlotLabel ->
TraditionalForm[Replace[ineqs, {} | False -> \[EmptySet]]],
Frame -> False]]
a12 = VennDiagram2[2, Subscript[A, 1] && Subscript[A, 2]]
a1 = Graphics[Text[dogs, {-0.9, 0}]]
b1 = Graphics[Text[brown, {0.9, 0}]]
Show[a12, a1, b1]

or
a32 = VennDiagram2[2, Not[Subscript[A, 1]] && Subscript[A, 2]]
a33 = VennDiagram2[2, Not[Not[Subscript[A, 1]] && Subscript[A, 2]]]
![]() |
![]() |