venn diagram_Venn Diagram Python软件包:Vennfig

venn diagram

目录 (Table of Contents)

  • Introduction

    介绍
  • Installation

    安装
  • Default Functions

    默认功能
  • Parameters

    参量
  • Examples

    例子
  • Conclusion

    结论

介绍 (Introduction)

In the last article, I showed how to draw basic Venn diagrams using matplotlib_venn.

在上一篇文章中 ,我展示了如何使用matplotlib_venn绘制基本的维恩图。

Each diagram requires 40 lines of code, so I created my first Python package, called Vennfig. You can draw a basic Venn diagram with one line of code, but flexible enough to meet your needs.

每个图需要40行代码,因此我创建了我的第一个Python包,称为Vennfig 。 您可以使用一行代码来绘制基本的维恩图,但是足够灵活以满足您的需求。

安装: (Installation:)

You can install it using pip:

您可以使用pip安装它:

pip install vennfig

On Jupyter:

在Jupyter上:

!pip install vennfig

You need to import vennfig.

您需要导入vennfig

import vennfig as v

默认功能 (Default Functions)

All the vennfig functions. 所有的vennfig函数。

This table shows all the functions you can use.

下表显示了您可以使用的所有功能。

All the default functions show the two Venn diagrams, e.g A AND B, A NAND B, except subsets and mut_exclusive functions.

subsetsmut_exclusive函数外,所有默认函数均显示两个维恩图,例如A AND B,A mut_exclusive

They have the default color, size, font size, titles, etc.

它们具有默认的颜色,大小,字体大小,标题等。

参量 (Parameters)

Parameters allow you to modify your Venn diagrams.

参数允许您修改维恩图。

Example:

例:

import vennfig as v
v.a_b(subs=2, size=6, fill_color='#f5b705', bg_color='#f7edd0',
font_size=25, title_a='P', set_a='P', set_b='Q')
Parameter names 参数名称

潜艇 (subs)

An identifier for the Venn diagrams you want to display.

您要显示的维恩图的标识符。

-1: default(both) -2: A -3: B

-1:默认(两者)-2:A -3:B

尺寸 (size)

Matplotlib figsize. The default is 15.

Matplotlib图figsize 。 默认值为15。

填色 (fill_color)

The default color is ‘skyblue’. You can use one of the characters {'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'}, which are short-hands for blue, green, red, cyan, magenta, yellow, black, and white. You can also use a hex RGB or RGBA string (e.g., '#4287f5' or '#4287f580').

默认颜色为“天蓝色”。 您可以使用以下字符之一: {'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'} ,它们是蓝色,绿色的简写形式,红色,青色,洋红色,黄色,黑色和白色。 您也可以使用十六进制RGB或RGBA字符串(例如'#4287f5''#4287f580' )。

bg_color (bg_color)

The bg_color sets the matplotlib’s facecolor which is the background color.

bg_color设置matplotlib的facecolor,即背景色。

The default is 'white'.

默认为'white'

字体大小 (font_size)

The title font size. The default is 20.

标题字体大小。 默认值为20

title_a (title_a)

The title for the left-side Venn diagram.

左侧维恩图的标题。

title_b (title_b)

The title for the right-side Venn diagram.

右侧维恩图的标题。

set_a (set_a)

The left-side set label. The default is 'A'.

左侧设置标签。 默认值为'A'

set_b (set_b)

The right-side set label. The default is 'B'.

右侧设置标签。 默认值为'B'

字体大小 (text_size)

This sets the text font size. The default value is 15.

这将设置文本字体大小。 预设值为15。

Let’s see how easy it is to draw Venn diagrams.

让我们来看看绘制维恩图有多么容易。

例子 (Examples)

A,B维恩图 (A, B Venn Diagram)

A , B default Venn diagrams A,B默认维恩图 A, B Venn diagram setting parameters. A,B维恩图设置参数。

A和B,A与非B维恩图 (A AND B, A NAND B Venn Diagram)

A AND B, A NAND B default Venn diagrams. A和B,A NAND B默认的维恩图。 A AND B default Venn diagrams setting parameters. A AND B默认的维恩图设置参数。

真,假维恩图 (TRUE, FALSE Venn Diagram)

TRUE, FALSE default Venn diagrams. TRUE,FALSE默认维恩图。 TRUE Venn diagram setting parameters. 真实的维恩图设置参数。

或,NOR维恩图 (OR, NOR Venn Diagram)

OR, NOR default Venn diagrams. 或,NOR默认维恩图。 NOR Venn diagram setting parameters. NOR维恩图设置参数。

XOR,XNOR维恩图 (XOR, XNOR Venn Diagram)

XOR, XNOR default Venn diagrams. XOR,XNOR默认的维恩图。 XOR Venn diagram setting parameters. XOR Venn图设置参数。

非A,非B维恩图 (NOT A, NOT B Venn Diagram)

NOT A, NOT B default Venn diagrams. 不是A,不是B默认的维恩图。 NOT Q Venn diagram setting parameters. NOT Q维恩图设置参数。

A NOT B,B NOT Venn图 (A NOT B, B NOT A Venn Diagram)

A NOT B, B NOT A default Venn diagrams. A NOT B,B NOT A默认维恩图。 P NOT Q Venn diagram setting parameters. P NOT Q维恩图设置参数。

隐含维恩图 (Implication Venn Diagram)

Implication default Venn diagrams. 隐含默认维恩图。 Q ⇒ P Venn diagram setting parameters. Q ⇒ P Venn diagram setting parameters.

互斥维恩图 (Mutually exclusive Venn Diagram)

Mutually exclusive default Venn diagram. 互斥的默认维恩图。 Mutually exclusive Venn diagram setting parameters. 互斥的维恩图设置参数。

补维恩图 (Complement Venn Diagram)

Complement default Venn diagrams. 补充默认的维恩图。 Complement Venn diagram setting parameters. 补充维恩图设置参数。

维恩图子集 (Subsets Venn Diagram)

Subsets default Venn diagram. 子集默认维恩图。 Subsets Venn diagram setting parameters. 子集Venn图设置参数。

终奌站 (Terminal)

You can use the terminal to create a Venn diagram.

您可以使用终端创建维恩图。

Running vennfig on a terminal. 在终端上运行vennfig。

You can use pan to move the diagram as well.

您也可以使用pan来移动图表。

The output from the terminal 终端的输出

结论 (Conclusion)

Let me know what you think. You can find the Github repo here.

让我知道你的想法。 您可以在这里找到Github仓库。

Please stay tuned for the next post.

请继续关注下一篇文章。

翻译自: https://towardsdatascience.com/introducing-basic-venn-diagram-python-package-vennfig-fa3f8e4dcb36

venn diagram

你可能感兴趣的:(venn diagram_Venn Diagram Python软件包:Vennfig)