Markdown image bug


I'm currently using RStudio Version 1.2.1335 in a Mac laptop. Everytime after running a code chunk in Markdown to plot something or import a jpg image, after a while that same images will block my view when I change from lines to write on other parts of Markdown. I have to go where the plot code is, "open and close" it again so it doesn't block my view when working in other parts. If I click on the consol window, it the image will automatically pop again and block my view of the Rmarkdown code.

I add some images of this problem

How can I fix this?

1 Like

One option would be to disable inline output for R Markdown documents. This way, instead of appearing in your document, the plot will be displayed in the Plots pane.

You can disable inline output by going to Tools -> Global Options... -> R Markdown and unchecking the box that says "Show output inline for all R Markdown documents". This will disable the inline plots generated by code chunks, like the one in screenshot above. Note that you may have to close and re-open RStudio for this new setting to apply.

If you also want to disable previewing of imported images (i.e. via the Markdown syntax ![](image.jpg), then in the same menu you can change the setting for "Show equation and image previews" from "Inline" to either "In a popup" (the image will be displayed in a thumbnail if you hover your mouse over the that line) or "Never".

Here's a screenshot of R Markdown Global Settings after disabling inline output from code chunks and displaying imported images in a popup:


I tried the first option (disable inline output) for the plot display, and I even restarted RStudio, but still displays the same problem.

1 Like

Realized I hadn't modified the "Show equiation and image previews", change it to "In a popup", restarted RStudio, but no change to display. Plots still block my Rmd codes.

1 Like

This sort of thing has happened to me occasionally in the past but not frequently enough to know how to reproduce the problem at will so I never opened a GitHub issue.

At least for me, the problem is solved by "clearing all output" and running all code chunks again.


Or in extreme occations deleting the hidden .Rproj.user folder on the project.


Another thing to check is to make sure you are using a R Markdown file (output: html_document) and not an R notebook (output: html_notebook).

Checked in different Rmd files I have, and they say in "output", "word_document", "pdf_document: default". So "output: html_document" is better?

Strangely, I don't have the "Clear Output" or "Clear All Output" in that pop up window.

How do I access ".Rproj.user" folder ?

That is because you have disabled inline output for code chunks

That is just a hidden folder inside your project folder, I'm not a Mac user so I don't know how to make it visible in your OS.

word_document and pdf_document are also fine. You just want to avoid html_notebook if you don't want inline output.

A reproducible example would be very helpful.

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