Having problems saving a neural net plot using neuralnet package - R

Viewed 4411

I'm using the neuralnet package in R, however am having problems saving the plot to disk.

data(iris)
attach(iris)
library(neuralnet)

nn <- neuralnet(as.numeric(Species) ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width, data = iris)

png("test.png")
plot(nn)
dev.off()

Have attempted to refere to the manual, in the section plot.nn() it says:

file      a character string naming the plot to write to. If not stated, 
the plot will not be saved.

However doing the following yields no valid plot saved:

png("test.png")
plot(nn, file = "test.png")
dev.off()

Platform:

Mac OSX 10.7.3

R version:

platform       x86_64-apple-darwin11.3.0    
arch           x86_64                       
os             darwin11.3.0                 
system         x86_64, darwin11.3.0         
status                                      
major          2                            
minor          15.1                         
year           2012                         
month          06                           
day            22                           
svn rev        59600                        
language       R                            
version.string R version 2.15.1 (2012-06-22)
nickname       Roasted Marshmallows  

Note: R was installed via macports

3 Answers

This worked for me after plotting plot(nn) :

dev.print(pdf, 'ANN_coefficients_plot.pdf') 
Related