All, I have: \startMPpage %figure library name: intersection %initialize scale numeric u; 10u=3in; %ellipses path A, B; A:=fullcircle xyscaled (4u,3u); B:=A shifted (2u,0); draw A withcolor red; label.ulft(btex $A$ etex, point 3 of A) withcolor red; draw B withcolor blue; label.urt(btex $B$ etex, point 1 of B) withcolor blue; %bounding box draw bbox currentpicture enlarged (0.5u,0.5u); \stopMPpage I need an easy way of shading these areas: 1. A intersect B 2. A union B 3. A intersect (complement of B) 4. (complement of A) intersect B Thanks
<--- On Jan 19, David Arnold wrote --->
All,
I have:
\startMPpage %figure library name: intersection
%initialize scale numeric u; 10u=3in;
%ellipses path A, B; A:=fullcircle xyscaled (4u,3u); B:=A shifted (2u,0); draw A withcolor red; label.ulft(btex $A$ etex, point 3 of A) withcolor red; draw B withcolor blue; label.urt(btex $B$ etex, point 1 of B) withcolor blue;
%bounding box draw bbox currentpicture enlarged (0.5u,0.5u);
\stopMPpage
I need an easy way of shading these areas:
1. A intersect B 2. A union B 3. A intersect (complement of B) 4. (complement of A) intersect B
There is venn.mp on ctan. Using it you can do basic shading of intersection, union etc for 0,1,2 or 3 sets very quickly. Read the documentation in source for details. For example \startMPinclusions input venn; pair A,B,T[]; A = (.4venn_width-.5venn_circle_diameter,.5venn_height); B = (.6venn_width+.5venn_circle_diameter,.5venn_height); T1 = (.5venn_width , 0); T2 = (.5venn_width,.5venn_height-.5venn_circle_diameter); vardef venn_shade = red; \stopMPinclusions \startMPpage draw_venn_two(false,true,true,true); label.lft(btex $A$ etex,A); label.rt(btex $B$ etex,B); label.bot(btex $A\cup B$ etex,T2); \stopMPpage \startMPpage draw_venn_two(false,false,true,false); label.lft(btex $A$ etex,A); label.rt(btex $B$ etex,B); label.bot(btex $A\cap B$ etex,T2); \stopMPpage \startMPpage draw_venn_two(true,false,false,false); label.lft(btex $A$ etex,A); label.rt(btex $B$ etex,B); label.bot(btex $A'\cap B'$ etex,T2); \stopMPpage Perhaps one can combine the transparent color functionality of metapost with venn.mp to get really nice colors for intersections etc. Another related question, does anyone know of a good way to hash (hatch) a "set" (in general, any mp closed curve). I know that there is hatching.mp but I was wondering if there are better solutions. Aditya -- Aditya Mahajan, EECS Systems, University of Michigan http://www.eecs.umich.edu/~adityam || Ph: 7342624008
On 1/20/06, Aditya Mahajan wrote:
<--- On Jan 19, David Arnold wrote --->
I need an easy way of shading these areas:
1. A intersect B 2. A union B 3. A intersect (complement of B) 4. (complement of A) intersect B
There is venn.mp on ctan. Using it you can do basic shading of intersection, union etc for 0,1,2 or 3 sets very quickly. Read the documentation in source for details. For example
Thanks a lot for the very nice example;
\startMPinclusions input venn; pair A,B,T[]; A = (.4venn_width-.5venn_circle_diameter,.5venn_height); B = (.6venn_width+.5venn_circle_diameter,.5venn_height); T1 = (.5venn_width , 0); T2 = (.5venn_width,.5venn_height-.5venn_circle_diameter); vardef venn_shade = red;
vardef venn_shade = red enddef; I tried the (transparent(.8,3,blue)) at that place, but it seems that either ConTeXt or Acrobat have problems here. It either compiled, but then Adobe Reader complained, if I tried to compile fill fullcircle scaled 3cm withcolor (transparent(.8,3,blue)); manually, then I got an error **\relax venn-mpgraph.3 (venn-mpgraph.3 ! Undefined control sequence. \handleMPspecialscommentx #1 ->\doifelse {#1}{10000}{\settrue \manyMPspecial... l.15 %%MetaPostSpecials: 2.0 123 1000 ? Missing character: There is no 1 in font nullfont! ...
Perhaps one can combine the transparent color functionality of metapost with venn.mp to get really nice colors for intersections etc.
Hans: please fix the typo on line 488 in mp-spec.mp. I copied the example from there and wondered why it didn't work (well, it still doesn't work - the problem described above). Mojca
Mojca Miklavec wrote:
I tried the (transparent(.8,3,blue)) at that place, but it seems that either ConTeXt or Acrobat have problems here. It either compiled, but then Adobe Reader complained, if I tried to compile fill fullcircle scaled 3cm withcolor (transparent(.8,3,blue)); manually, then I got an error
% fill fullcircle scaled 10cm withcolor transparant(8,.3,red) ; Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 1/20/06, Hans Hagen wrote:
Mojca Miklavec wrote:
I tried the (transparent(.8,3,blue)) at that place, but it seems that either ConTeXt or Acrobat have problems here. It either compiled, but then Adobe Reader complained, if I tried to compile fill fullcircle scaled 3cm withcolor (transparent(.8,3,blue)); manually, then I got an error
% fill fullcircle scaled 10cm withcolor transparant(8,.3,red) ;
Hans
Thanks. Two typos then :) (transparant -> transparent). Mojca
participants (4)
-
Aditya Mahajan
-
David Arnold
-
Hans Hagen
-
Mojca Miklavec