On Mon, 13 Feb 2023 13:08:18 +0900 Shunran Zhang <szh...@ngs.gen-info.osaka-u.ac.jp> wrote:
> In the code, calling image(sparseMatrix) works outside > of a for loop - the image file is written. Calling > image(as.matrix(sparseMatrix)) also works inside a for loop thus > eliminating file access problem. However when using > image(sparseMatrix) inside for loop, no image file is produced, nor > is there any error message. image() methods for Matrix objects use lattice graphics: they internally call levelplot(). Lattice graphics don't directly draw their plots; instead, they return objects of class "trellis" whose print.trellis method actually performs the drawing. (The same thing happens with ggplot2 graphics.) You can use plot(image(...)) or print(image(...)) to force the plot to be rendered even when there's no auto-printing (such as when you're inside a for loop). -- Best regards, Ivan ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.