Skip to content

Commit dd632d1

Browse files
committed
Nicer GraphPlot settings (layout, colors, and edge weights)
1 parent 7044372 commit dd632d1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/BayesNets.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import Base: *, /, +, -
1919
import DataStructures: PriorityQueue, peek
2020
import BayesNets.CPDs.ProbabilisticGraphicalModels: markov_blanket, is_independent, infer
2121
import StatsBase: sample, Weights
22-
import GraphPlot: gplot
22+
import GraphPlot: gplot, stressmajorize_layout
2323
import LightGraphs: DiGraph, add_edge!, rem_edge!,
2424
add_vertex!, rem_vertex!, has_edge,
2525
edges, topological_sort_by_dfs, inneighbors,

src/io.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ lualatex_available() = try success(`lualatex -v`) catch; false end
55
Base.showable(::MIME"image/svg+xml", bn::BayesNet) = true
66

77

8-
plot(dag::DAG, nodelabel) = gplot(dag, nodelabel=nodelabel) # GraphPlot (default)
8+
plot(dag::DAG, nodelabel) = gplot(dag,
9+
nodelabel=nodelabel,
10+
layout=stressmajorize_layout,
11+
nodefillc="lightgray",
12+
edgestrokec="black",
13+
EDGELINEWIDTH=0.3) # GraphPlot (default plotting)
14+
915

1016
# called at runtime (replaces plot with TikzGraphs, if loaded)
1117
function __init__()

0 commit comments

Comments
 (0)