How to change the images size when using knit to word in r-markdown - r

I am using a for loop to generate a lot of images to put into a word document.
To get them in i use the ! [Alt text] (/Users/Antonio/Documents/images/tufte.book.jpg) method.
This works well but regardless of what I do i am not able to make the image bigger (fill the entire page)
Any ideas on how to progress?

Related

Controlling the size of the HTML file when saving file

can someone help me to resize an HTML file produce with plotly in Jupyter?
This is the code I am using to save to an HTML file:
fig.write_html("D:\jupyter\image.html")
It works but now I want to control for the size. Here (https://plotly.com/python/interactive-html-export/) is suggested how to do it but I cannot get my head around to how specifically write the code to not get a big image
If you type fig.write_html? inside a cell you can read all the documentation, which is a little more explicit than the document you posted. In short
fig.write_html("output.html",
include_plotlyjs="cdn")
Should produce a file ~3MB smaller than the one you are getting now as this option point to the plotly.js online instead of include it on the output.

Figures or plots with accompanying thumbnails, like in RStudio

When I create plots within a single chunk of an R-Studio markdown file, they appear in a nice array with clickable thumbnails:
However, when I publish as an HTML file, these figures are simply displayed vertically, one after the other. Is there any way to achieve the way that it originally looks in RStudio?
Unfortunately there's no way to output what RStudio shows you, but you can do this and a lot of other HTML formatting yourself using the knitrBootstrap package.
Check out the end of this example for a clickable-thumbnail example.

Unexpected displaying multiple images with skimage io submodule

Hi, I'm trying to display multiple images in jupyter's iPython's notebook.
I'm using skimage.io.imshow() function to display each of it. I don't want to use skimage.io.imshow_collection() beacause it displays image with a smaller resolution
This is my code:
io.imshow(x_i)
io.imshow(z_i_norm)
io.imshow(x_prime_i_norm)
io.imshow(y_i)
This is the result: result
I'm expecting to display all images in just one output box
Thanks

Knitting R Markdown to PDF Image Embedding issue

When I try to embed successive images in my .Rmd document, the first one will work fine, but the second one will not be there but whatever I say after it is. So my code will look something like this:
![caption](image1.png)
Words, words, and more words
![caption](image2.png)
Again more words
The knitted document will look something like this if you can imagine it:
PAGE 1:
image1 with caption
Words, words, and more words
Again, more words
PAGE 2:
image2 with caption
I would want image 2 to be above "Again, more words" but it skips a page. The image would certainly fit on the page, and I've tried every small formatting thing I know with R markdown. But, the only remedy that works but is ugly is to include a page break after each image, which leaves a ton of whitespace on the page. Thanks in advance.

In RMarkdown Word document, how to make table of contents appear later

When an RMarkdown document is knit to Word, the Table of Contents (if there is one) always appears at the beginning of the document. If I want to, say, make the Table of Contents appear on the second page of the document, how do I do so?
If I was knitting to HTML I could use this method, but it doesn't seem to work for Word. Meaning, I create a Word template to be used in the reference_docx YAML argument and put the Table of Contents at the bottom of this template, but when I knit a report the Table of Contents appears at the front of the document.
Preferably, I'd like to use a solution that doesn't rely on VBA/VBS and instead uses RMarkdown and (if necessary) a reference_docx file only.
As explained here, based on this and this, you could change the style of the date in the Word document to add a page break after it.
Of course, that only separates the title page from the table of contents and if you want to insert other pages between those two, it wouldn't work.
But at least that's an idea to start from.
I've just been playing around with this issue myself. Unfortunately, I don't think Word allows you to modify a style to insert a break after a style, only before.
However, the TOC header is a style that is created when a TOC is included and can be modified. If you change the TOC header style to include a page break before, save this as your reference style document and run it forces the TOC onto a new page when knit.
As #Ben notes though this only allow you to move the TOC off the title page, not insert it where you want within the document.
I was searching for a solution to this today and came across Garrick Aden‑Buie's blog post and render_toc() function.
Full details of which can be found here or his gist
This function allowed me to move the TOC later in to the document.

Resources