I have a Venn diagram with some overlapping ellipses that I segmented into sections using lines.
I want to use this to make a few figures, and I am wondering wether there is a clever / clean way to do this.
I have the following questions:
Segment Firstly I want to segment each of the spaces created by the intersections of lines in the figure (that are labeled a trough h).
Merge Next, I want to make a few plots where I highlight different merges. E.g. I have a plot where a is colored red, b is colored green, and d+c are colored yellow. I plan to have the outlines of all segments still visible (d and c still have a separate line) but with low alpha.
Label It would be nice to use some tikz magic for automatic labeling. Specifically, it would be nice to have labels automatically in the centre of each section or to be able to specify some text exactly centred above some of the sections.
Approach To me, the most sanity-preserving solution seems to be to "declare" the segments once, and then use the segment names to shade/outline/label them.
I do not have a lot of experience with tikz, so I do not know if this is really the best way. My only experience with tikz was in making graphs, but I do not fully understand the concept of nodes and other types of objects in the figure.
\begin{tikzpicture}[line/.style={line width = 2pt}]
\draw[line, red] (0,0) ellipse (6 and 4);
\draw[line, blue] (-2,0) ellipse (2 and 3);
\draw[line, green] (1.5,-1.7) ellipse (3 and 1.5);
\node at (-2, 2.5) {a};
\draw[line, blue] (-3.5,2) -- (-0.5,2);
\node at (-2, 1.2) {b};
\draw[line, blue] (-4,0.6) -- (0,0.6);
\node at (-2, -1.2) {c};
\node at (-3.4, -1.2) {d};
\draw[line, blue] (-3,0.6) -- (-3,-2.6);
\node at (-0.5, -0.9) {e};
\node at (-1, -1.6) {f};
\draw[line, orange] (-1.2,-1) -- (-0.2,-1.3);
\node at (1, -1.6) {g};
\node at (3.2, -1.6) {h};
\draw[line, green] (2.5, -0.3) -- (2.5, -3.2);
\end{tikzpicture}
Solutions found
- 1. This does not really seem to create nodes, it just fills a section.
- 2, 3 this one seems to be quite close to what I want, there circles are "defined" as I would like them to be. I probably need to convert my lines to rectanges to do the intersections but I am not sure about the cleanest way do do so.
I realise this is quite a specific problem, and I do not expect a fully coded solution, but any directions on how to go about this would be great! :)
Hopefully someone can help me! :)
Edit: All the merges I want to make could also be done by doing clips (e.g. for d+c just clip the blue circle with by the bottom horizontal line) so if merging is not possible, that is alright.


