2025年juyter显示决策树图形_python – 在Jupyter笔记本中绘制交互式决策...

juyter显示决策树图形_python – 在Jupyter笔记本中绘制交互式决策...使用 Jupyter Notebook 中的 d3js 更新了可折叠图形的答案 在笔记本电脑中启动第一个单元 html node circle cursor pointer stroke 3182bd stroke width 1 5px node text font 10px

大家好,我是讯享网,很高兴认识大家。

使用Jupyter Notebook中的d3js更新了可折叠图形的答案

在笔记本电脑中启动第一个单元

%%html

.node circle {

cursor: pointer;

stroke: #3182bd;

stroke-width: 1.5px;

}

.node text {

font: 10px sans-serif;

pointer-events: none;

text-anchor: middle;

}

line.link {

fill: none;

stroke: #9ecae1;

stroke-width: 1.5px;

}

笔记本电脑中的第一个电池结束

在笔记本中开始第二个单元格

%%javascript

// We load the d3.js library from the Web.

require.config({paths:

{d3: "http://d3js.org/d3.v3.min"}});

require(["d3"], function(d3) {

// The code in this block is executed when the


讯享网

// d3.js library has been loaded.

// First, we specify the size of the canvas

// containing the visualization (size of the

//

element).

var width = 960,

height = 500,

root;

// We create a color scale.

var color = d3.scale.category10();

// We create a force-directed dynamic graph layout.

// var force = d3.layout.force()

// .charge(-120)

// .linkDistance(30)

// .size([width, height]);

var force = d3.layout.force()

.linkDistance(80)

.charge(-120)

.gravity(.05)

.size([width, height])

.on("tick", tick);

var svg = d3.select("body").append("svg")

.attr("width", width)

.attr("height", height);

var link = svg.selectAll(".link"),

node = svg.selectAll(".node

小讯
上一篇 2025-01-26 14:45
下一篇 2025-03-16 10:18

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/49682.html