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)

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.
除subsets
和mut_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')

潛艇 (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,A與非B維恩圖 (A AND B, A NAND B Venn Diagram)
真,假維恩圖 (TRUE, FALSE Venn Diagram)
或,NOR維恩圖 (OR, NOR Venn Diagram)
XOR,XNOR維恩圖 (XOR, XNOR Venn Diagram)
非A,非B維恩圖 (NOT A, NOT B Venn Diagram)
A NOT B,B NOT Venn圖 (A NOT B, B NOT A Venn Diagram)
隱含維恩圖 (Implication Venn Diagram)
Q ? P Venn diagram setting parameters.
Q ? P Venn diagram setting parameters.
互斥維恩圖 (Mutually exclusive Venn Diagram)
補維恩圖 (Complement Venn Diagram)
維恩圖子集 (Subsets Venn Diagram)
終奌站 (Terminal)
You can use the terminal to create a Venn diagram.
您可以使用終端創建維恩圖。

You can use pan
to move the diagram as well.
您也可以使用pan
來移動圖表。

結論 (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
本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。 如若轉載,請注明出處:http://www.pswp.cn/news/389111.shtml 繁體地址,請注明出處:http://hk.pswp.cn/news/389111.shtml 英文地址,請注明出處:http://en.pswp.cn/news/389111.shtml
如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!