Graphviz之DT:手把手教你使用視覺化工具Graphviz將dot檔案轉為結構圖的pdf檔案
阿新 • • 發佈:2018-12-26
Graphviz下載安裝
第一步:我們首先下載視覺化工具Graphviz,百度,官網可直接下載,不過比較慢,我這裡有雲盤連結https://pan.baidu.com/s/1c2uFojA,點選即可下載
雲盤更新
連結:https://pan.baidu.com/s/1r9f4eypdHQ0K96R2d7w7eg 密碼:7l7s
第二步:安裝Graphviz,一路next即可,
Graphviz配置環境
第三步:在計算機上設定環境變數,將安裝路徑載入到path上
Graphviz使用方法
第四步:cmd,在dos環境下,dot-Tpdf input.dot -o convertoutput.pdf命令,即可將niu.dot轉為niu.pdf,大功告成啦,哈哈
我的dot檔案是下邊這個模樣
digraph Tree { node [shape=box] ; 0 [label="native=no <= 0.5\nentropy = 0.985\nsamples = 14\nvalue = [6, 8]"] ; 1 [label="entropy = 0.0\nsamples = 7\nvalue = [0, 7]"] ; 0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ; 2 [label="income=high <= 0.5\nentropy = 0.592\nsamples = 7\nvalue = [6, 1]"] ; 0 -> 2 [labeldistance=2.5, labelangle=-45, headlabel="False"] ; 3 [label="entropy = 0.0\nsamples = 6\nvalue = [6, 0]"] ; 2 -> 3 ; 4 [label="entropy = 0.0\nsamples = 1\nvalue = [0, 1]"] ; 2 -> 4 ; }
第五步:觀察pdf檔案即可,哈哈,五步,so easy!