TransWikia.com

Figures showing at the end of the document in R markdown

TeX - LaTeX Asked by hyeri on January 24, 2021

I have been working on this issue since yesterday and have checked almost all the solutions but I’m still not able to solve this issue. All the figures and tables I put in the document shows at the end of the document instead of where I place them.

fig_cap           : yes
keep_tex          : yes
floatsintext      : no
figurelist        : no
tablelist         : no
footnotelist      : no
linenumbers       : no
mask              : no
draft             : no


documentclass     : "apa6"
classoption       : "man"
output            : papaja::apa6_pdf
header-includes:
 usepackage{float}
 floatplacement{figure}{H}

I have added float package as well as fig_cap in yaml above as recommended in some other solutions. Also I have globally defined fig.pos = H

```{r global_options, include=FALSE}
knitr::opts_chunk$set(fig.pos = 'H')
```

This is the histogram I’m trying to showin between my paragraphs (it moves down to the end of document as soon as I use fig.cap)

```{r Histogram, out.width = "90%", out.height = "100%", fig.align = "center", fig.pos='H', out.extra = '',fig.cap= "eee", echo=FALSE}
histogram_plot <- ggplot(dataset1, aes(x=SocialNetworkUse))+
  geom_histogram(bins = 30) +
  labs(x="Social Network Use (Hours)", y = "Respondents")
  histogram_plot
```

Now this is the what I’m getting in my tex file

begin{figure}[H]

{centering includegraphics[width=0.9linewidth,height=1textheight,]{ANLY-699_files/figure-latex/Histogram-1} 

}

caption{eee}label{fig:Histogram}
end{figure}

However the fff files shows this output

begin{figure*}[hbt]
ifnextchar[{eatarg}{}
[H]

    {centering includegraphics[width=0.9linewidth,]{ANLY-699_files/figure-latex/Histogram-1}
    
    }
    
    caption{foff}label{fig:Histogram}
    end{figure*}

Fairly new to Rmarkdown and not sure what’s causing the figures to not stay in place. Any help would be appreciated.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP