I am using sweave to drawing plots and I want to fix the position of R code without fix the position of graphs, that's to say I would like to keep the position of code in the text but have graphs floating, what should I do? Thank you
It sesms that it's not clear so I put the code there:
text before the figure
\begin{figure}
<<smokefig, fig.width=3, fig.height=3>>=
tabSmoke<-table(ps$smoke)[2:5]
par(mar = c(2, 4.1, 0.1, 0.1))
with(ps,barplot(100*tabSmoke/sum(tabSmoke),ylim=c(0, 110), las = 2,
cex.axis = 0.75,cex.names = 0.75,col = c("pink","lightblue")))
@
\caption{Pourcentages des fumeurs et non-fumeurs selon les quatre modalités}
\end{figure}
text after the figure
what I want is to have R code appears between the line, like
text before the figure
tabSmoke<-table(ps$smoke)[2:5]
par(mar = c(2, 4.1, 0.1, 0.1))
with(ps,barplot(100*tabSmoke/sum(tabSmoke),ylim=c(0, 110), las = 2,
cex.axis = 0.75,cex.names = 0.75,col = c("pink","lightblue")))
text afther the figure
and then the figure could appear wherever it wants
but it turns out that the code floats with the figure and they appear together at the next page like this:
output of code lines
output of figure
This is what I have put in header, in case it might be helpful
\documentclass[10pt]{article}
\usepackage{geometry}
\geometry{a4paper,scale=0.75}
\author{me}
\title{title}
\begin{document}