➡️ Introduction
➡️ A, B
➡️ TRUE, FALSE
➡️ A AND B, A NAND B
➡️ A OR B️, A NOR B️
➡️ A XOR B️, A XNOR B️
➡️ NOT A, NOT B
➡️ A NOT B, B NOT A
➡️ Implication, A → B, B → A
➡️ Mutually exclusive
➡️ Complement
➡️ Subset
➡️ Conclusion

In this newsletter, you’ll in finding how to draw basic Venn diagrams on Jupyter. We’ll use matplotlib-venn for this goal. The matplotlib-venn is for plotting area-weighted two- and three-circle Venn diagrams. We are going to use the two-circle Venn-diagrams for many of Venn diagrams.

Let’s get began.

We will import venn2 and venn2-circles and create one row, two columns subplots. I used this set-up for many of the figures on this article.

If you wish to have codes with out subplots for all Venn diagrams, you’ll be able to in finding them in this link.

The venn2-circles provides you with higher keep an eye on for the threshold strains than the usage of set-edgecolor, so we use each venn2 and venn2-circles.

We set ax=ax1 for v1 and c1 with the similar subset values in order that each will overlap properly.

We use for loops to undergo every field. You can in finding the world IDs under.

In the for loop, we set the colors. We can use one of the vital characters {'b', 'g', 'r', 'c', 'm', 'y', 'okay', 'w'}, that are short-hands for blue, inexperienced, purple, cyan, magenta, yellow, black, and white. Also, you’ll be able to use a hex RGB or RGBA string (e.g., '#4287f5' or '#4287f580').

For field A, we set the colour within the field ID 10 and 11.

For field B, we set the colour within the field ID 11 and 01.

We use get_patch_by_id to set_color and set_alpha. If you don’t use set_alpha the colour of the world would be the aggregate if the world is overlapped.

We want to take away numbers, so we use the next to do the task.

We use set_axis_on to set a rectangle boundary and use set_facecolor to set the colour within the rectangle.

We use set_title to set the name and the font dimension.

We want to give some house on the backside so we use the next code to do the task.

For the “TRUE” Venn diagram, we set the colour skyblue for all spaces within the for loop.

Similarly, for the“FALSE” Venn diagram, we set the colour white for all spaces within the for loop.

For the “A AND B” Venn diagram, we set the colour skyblue for the world 11.

For “A NAND B” Venn diagram, we set the colour skyblue to all of the spaces together with the facecolor aside from for the world 11.

For the “A OR B” Venn diagram, we set the colour skyblue for all of the spaces, 10, 11, 01 and set the colour white to facecolor.

For the “A NOR B” Venn diagram, we set the colour white to all of the spaces and set skyblue to the facecolor.

For the “A XOR B” Venn diagram, we set the colour skyblue for the spaces 10 and 01.

For the “A XNOR B” Venn diagram, we set the colour skyblue to the spaces 11 and facecolor.

For the “NOT A” Venn diagram, we set the colour skyblue for the world 01 and facecolor, another way, we set the colour white to the spaces 10 and 11.

For the “NOT B” Venn diagram, we set the colour white for the spaces 01 and 11 and we set the colour skyblue for the world 10 and facecolor.

For the “A NOT B” Venn diagram, we set the colour skyblue to the world 10, another way, we set the colour white to all different spaces.

For the “B NOT A” Venn diagram, we set the colour skyblue to the world 01, another way, we set the colour white to all different spaces.

For the implication “A → B” Venn diagram, we set the colour white to the world 10 another way, we set the colour white to all different spaces.

For the implication “B → A” Venn diagram, we set the colour white to the world 01 another way, we set the colour white to all different spaces.

For the mutually unique Venn diagram, we set the colour skyblue to the spaces 10 and 01.

You may draw a unmarried circle with a circle patch and a rectangle patch, however we’re going to use venn3 and venn3_circles. We draw 3 circles however we’re going to cover two circles by environment the colour white which is equal to the facecolor.

By the usage of the three-circles IDs, we will alter its houses.

We additionally added U by the usage of textual content.

v.get_label_by_id() returns an object this is an example of matplotlib.text.Text. I sought after to display you the way to alternate its houses by the usage of set_fontsize, set_color, set_rotation strategies on this instance.

We can use venn2 and venn2_c to create a subset Venn diagram. We set 0 to the world 11.

The matplotlib-venn bundle is for plotting area-weighted two- and three-circle Venn diagrams however the usage of your inventive thoughts you’ll be able to create one-circle Venn diagram as smartly.

Please keep tuned for the following submit.

LEAVE A REPLY

Please enter your comment!
Please enter your name here