Entering edit mode
João Daniel Nunes Duarte
▴
30
@joao-daniel-nunes-duarte-4710
Last seen 10.4 years ago
Hello,
I'm starting to use the combination bnlearn and Rgraphviz, and it
generates
wonderful bayesian network plots! Congratulations!
However I'm facing some strange issue: bayesian networks generated
from some
specific dataframe have text inside ellipses very big, and it's
unformatting
the plot.
The commands I used are as follow:
# load data frame
d <- read.csv2("financ_auto.csv", row.names=1)
# omit NA's
d <- na.omit( d )
# Iterate all variables
for(i in 1:ncol(d)) {
if(is.numeric(d[[i]])) {
# Categorize variable if it's numerical
d[[i]] <- cut(d[[i]],5)
}
}
# Generate bn object (graph)
bn <- mmpc(d)
# Generate pdf
tf <- tempfile()
pdf( tf, width = 20, height = 20)
graphviz.plot(bn, shape="ellipse", layout="neato")
dev.off()
tf
The dataframe file and generated plot are on the following links:
http://www.mediafire.com/file/zp58zg6l28hn49m/financ_auto.csv
http://www.mediafire.com/file/l4lj4gzkohw8yhy/plot.pdf
Does anyone knows what may be happening?
Thanks in advance!
Cheers,
Joao D. Duarte
UFMG - Brasil
[[alternative HTML version deleted]]