Search code examples
rmachine-learningkerasrstudiovisualization

How to make plots appear in Rmarkdown file instead of viewer pane when working with keras in Rstudio?


I am new in R and trying keras in Rstudio. All the accuracy, loss interactive plots by running fit() are appearing in Viewer pane instead of Rmarkdown file.

All other plots usually plot inside Rmarkdown files but not with keras.

I have also checked Global settings in Rstudio Tools>Global Options>R Markdown>Show output preview in "Window".

How do I make them plot in Rmarkdown instead of Viewer Pane.

How do I make this mandatory for all plots to create inside Rmarkdown files only and now in viewer pane?


Solution

  • have you tried to plot in only one cell ?

    for example you have a code block only like this

    plot(x = dataframe$x, y = dataframe$y,
       xlab = "X",
       ylab = "Y",
       xlim = c(0,1.5),
       ylim = c(0,1.5),
       main = "X and Y between 0 and 1",
       col = dataframe$color,
       pch = 16,
       cex = 1.5
    )
    

    if you convert the rmarkdown file into html, the output of the plot will be shown enter image description here

    like this, in the browser. the only criteria you need to respect is put the plot function call alone in one cell