Save a Section of a PNG in R

Hi All,

I've been using a library in R called 'aweSOM.' It's a library based upon providing HTML-interactive visuals for self-organising maps (SOMs).

aweSOM produces some nicer visuals than similar SOM packages, so I'd to use it. However, the problem is two-fold:

  1. HTML-interactive visuals are not suitable for publication.
  2. When I save as a PNG, there is (interactive) text remaining on the
    PNG 'Hover Over The Plot For Information.'

Therefore, I wondered if it is possible to write a function such that the 'plot' is saved as a PNG but without the interactive text above?

Therefore, effectively write a function that saves only a square of a particular size that would omit the text?

Would appreciate your feedback and assistance.

install.packages("aweSOM")
library(aweSOM)

full.data <- iris
train.data <- full.data[, c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width")]
train.data <- scale(train.data)

set.seed(1465)
init <- somInit(train.data, 4, 4)
iris.som <- kohonen::som(train.data, grid = kohonen::somgrid(4, 4, "hexagonal"), 
                         rlen = 100, alpha = c(0.05, 0.01), radius = c(2.65,-2.65), 
                         dist.fcts = "sumofsquares", init = init)

superclust_pam <- cluster::pam(iris.som$codes[[1]], 3)
superclasses_pam <- superclust_pam$clustering

###########
#PROBLEMATIC PLOT WITH INTERACTIVE TEXT
##########

plot <- aweSOMplot(som = iris.som, type = "Cloud", data = full.data, 
           variables = c("Species", "Sepal.Length", "Sepal.Width",  
                         "Petal.Length", "Petal.Width"), 
           superclass = superclasses_pam)

All help would be appreciated with fixing the visualisation. A vignette is here:

https://cran.r-project.org/web/packages/aweSOM/vignettes/aweSOM.html#the-awesom-package

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.