1

I want to produce a boxplot like this in R:

fishdata <- read.csv("http://dl.dropbox.com/s/4w0utkqdhqribl4/fishdata.csv", header=T)
attach(fishdata)
boxplot(fishdata[,-1], las=3)

which looks like this:

what it should look like

but when I Sweave this, using this coding:

<<echo=F>>=
fishdata <- read.csv("http://dl.dropbox.com/s/4w0utkqdhqribl4/fishdata.csv", header=T)
attach(fishdata)
@ 

\begin{figure}[htbp]
\centering
<<fig=T, echo=F>>=
boxplot(fishdata[,-1], las=3)
@
\rule{35em}{0.5pt}
\caption{Boxplot of the fish catches in Bangladesh from 1950 to 2011.}
\label{histogram}
\end{figure}

produces this still,

boxplot output

Is there a way to get the x-axis titles as above in the coding?

4
  • 1
    I took the liberty to include a screenshot of the output you want to see because your problem at first wasn't very clear to me. Hope that's ok. – Christian Mar 9 '14 at 14:29
  • 2
    I can't reproduce this (R development version/3.1.0); simply adding \documentclass{article}; \begin{document} ; ... \end{document} to your MWE, I get final output with vertical x-axis labels as you wanted. (Have you tried clearing out any previously created plot files?) – Ben Bolker Mar 9 '14 at 16:59
  • 1
    @BenBolker - yes deleting the previous plots files worked! Thanks – hgeop Mar 9 '14 at 18:07
  • 1
    @hgeop, perhaps post that as an answer. (You are encouraged to answer your own questions if you can.) – Ben Bolker Mar 9 '14 at 19:35
4

I'll be your Answer the Unanswered officer tonight;

From the comments, it has been verified that in certain cases, it might happen that in such cases deleting the previous plot files is needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.