Hi Eduardo
I have just realized that I did not my send previous message to r-help
You do not need to put it in a float but you must
create the graph in a chunk, all you need is the \includegraphic command
This may avoid float space problems and make it easier for many graphs.
with the appropriate reference labels or
bookmarks using pdfbookmark or with with the \usepackage{zref}
(I have only looked at it - I need a very full
quick start guide for it as my requirements are complicated.)
If you get Sweave to do it automaticaly it puts it in a float
Duncan
At 04:20 07/08/2011, you wrote:>Hi there
>
>Many thanks. I will test each one of the options you sent me.
>
>If you have the time and patience I wonder
>whether you could help me to understand what
>Sweave can do. Although I have read Sweave
>manual I could not grasp it completely. For instance:
>
>a) How many options can I set when issuing << =>>?
>b) In a R session, is there a way to save a
>entry set of commands n a RnW file?
>
>Once more thank you ever so much. I owe you big time.
>
>Regards
>
>Ed
>
>
>
>On Aug 6, 2011, at 10:40 AM, Duncan Mackay wrote:
>
>>Hi
>>
>>You can do it directly - I cannot remember how
>>I did this sort of thing as it prefer to create the graph first
>>
>><<label=test, fig=TRUE, width=4, height=4,
echo=TRUE>>>>plot(x = 1,y=1)
>>@ %% test end
>>above is untested
>>
>>I normally do something like this - just cut
>>down the height or specify exactly the
>>dimensions in trellis.device, postscript , pdf
>>I use pdflatex to compile my tex files
>>
>><<lattice1>>>>trellis.device(file = outfile.pdf,
>> device = pdf,
>> height = 2.5,
>> width = 7,
>> paper = "special")
>>
>>xyplot(rnorm(10 ~ 1:10}
>>dev.off
>>@ %% end
>>
>>Device used depends on how you compile latex
>>etc and if it is from the basic plot group or
>>lattice etc, but I have found for lattice trellis.device suits.
>>
>>you can specify your own options for the sweave chunk whether to show or
hide
>>\begin{figure}[!h]
>>\centering
>>\includegraphics[width=6in,%
>> clip=true,%
>> keepaspectratio=true]%
>> {outfile.pdf}
>>\caption[short caption]%
>>{long caption}%
>>\label{fig:lattice1}
>>\end{figure}
>>
>>
>>For a full page figure I specify height=0.9\textheight or something like
that
>>
>>This suits my purpose for what I am doing at
>>the moment - others may have different ways
>>
>>HTH
>>
>>Duncan
>>
>>At 22:44 06/08/2011, you wrote:
>>>Hi there
>>>
>>>Would you be so kind to send an example, please?
>>>
>>>Many thanks
>>>
>>>Ed
>>>
>>>
>>>
>>>On Fri, Aug 5, 2011 at 9:43 PM, Duncan Mackay
>>><<mailto:mackay@northnet.com.au>mackay@northnet.com.au >
wrote:
>>>Hi
>>>The are three places where the size of the graphs can be customised
>>>1 Sweave with options
>>>2 R in the device
>>>3 Latex specifying dimensions or set scale=magnification.
>>>However if your are using it in a float it there
>>>is a maximum size depending on the number of floats in a page.
>>>see \floatsep and associated commands
>>>In Sweave/R what you change depends on how you
>>>want to work with the graphics
>>>Duncan
>>>
>>>
>>>
>>>At 00:23 06/08/2011, you wrote:
>>> >Hello
>>> >
>>> >Many thanks for the replies.
>>> >
>>> >Solution 1 (landscape package) works but the
>>> output figure is kind of small.
>>> >
>>> >Solution2: includegraphics outside -
>>> >Unfortunately it does not work. Includegraphics cannot find
Myfig.
>>> >
>>> >Solution 3- \usepackage[figureright]{rotating}
>>> >works and the output figure is in a reasonable size.
>>> >
>>> >I am using print(xyplot) from lattice to plot
>>> >the figures and have noticed that adding width
>>> >and height options breaks Sweave in all cases.
>>> >
>>> >Cheers
>>> >
>>> >Ed
>>> >
>>> >
>>> >
>>> >On Fri, Aug 5, 2011 at 3:07 AM, Duncan Mackay
>>> ><<
mailto:mackay@northnet.com.au>mackay@northnet.com.au> wrote:
>>> >Hi Eduardo
>>> >
>>> >in the preamble put
>>> >
>>> >\usepackage[figureright]{rotating}
>>> >
>>> >see manual for figureright if you do not like it
>>> >
>>> >and then some graphics with options where needed
>>> >
>>> >\begin{sidewaysfigure}
>>> >\centering
>>> >\includegraphics[width=,%
>>> > clip=true,%
>>> > trim=0in 0in 0in 0in,% LBRT
>>> > keepaspectratio=true]%
>>> > {filename}
>>> >\end{sidewaysfigure}
>>> >
>>> >otherwise \usepackage landscape (check spelling) for a full
page
>>> >
>>> >HTH
>>> >
>>> >Duncan
>>> >
>>> >Duncan Mackay
>>> >Department of Agronomy and Soil Science
>>> >University of New England
>>> >ARMIDALE NSW 2351
>>> >Email: home <
mailto:mackay@northnet.com.au>mackay@northnet.com.au
>>> >
>>> >
>>> >
>>> >At 05:58 05/08/2011, you wrote:
>>> >On 04/08/2011 3:40 PM, Eduardo M. A. M. Mendes wrote:
>>> >Dear R-users
>>> >
>>> >I am trying to understand how Sweave works by
>>> >running some simple examples. In the example I
>>> >am working with there is a chunk where the
>>> >R-commands related to plotting a figure are
>>> >placed. When running R CMD Sweave … , pdflatex
>>> >the output is a portrait figure. I wonder
>>> >whether it would be possible to change the
>>> >orientation to landscape (not in the latex file but in Rnw
file).
>>> >
>>> >
>>> >Sweave can change the height and width of the
>>> >figure so it is more landscape-shaped (width >
>>> >height) using options at the start of the chunk.
>>> >
>>> >Rotating a figure is something LaTeX needs to
>>> >do: you would tell Sweave to produce the figure
>>> >but not include it, then use \includegraphics{}
>>> >with the right option to rotate it.
>>> >
>>> >For example:
>>> >
>>> ><<Myfig, fig=TRUE, include=FALSE, width=7in,
height=4in>>>>> >plot(rnorm(100))
>>> >@
>>> >
>>> >\includegraphics[angle=90,width=0.8\textheight]{Myfig}
>>> >
>>> >This is untested, and you'll need to consult a
>>> >LaTeX reference for rotating the figure caption, etc.
>>> >
>>> >Duncan Murdoch
>>> >
>>> >______________________________________________
>>> ><
>>> mailto:R-help@r-project.org><mailto:R-help@r-project.org>
>>> R-help@r-project.org mailing list
>>> ><
>>> https://stat.ethz.ch/mailman/listinfo/r-help >
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> >PLEASE do read the posting guide
>>> ><
>>> http://www.R-project.org/posting-guide.html >
>>> http://www.R-project.org/posting-guide.html
>>> >and provide commented, minimal, self-contained, reproducible
code.
>>> >
>>> >
>>> >______________________________________________
>>> ><
>>> mailto:R-help@r-project.org><mailto:R-help@r-project.org>
>>> R-help@r-project.org mailing list
>>> ><
>>> https://stat.ethz.ch/mailman/listinfo/r-help >
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> >PLEASE do read the posting guide
>>> ><
>>> http://www.R-project.org/posting-guide.html >
>>> http://www.R-project.org/posting-guide.html
>>> >and provide commented, minimal, self-contained, reproducible
code.
>>> >
>>> [[alternative HTML version deleted]]
>>>
>>>______________________________________________
>>><mailto:R-help@r-project.org>R-help@r-project.org mailing list
>>><https://stat.ethz.ch/mailman/listinfo/r-help>https://stat.ethz.ch/mailman/listinfo/r-help
>>>
>>>PLEASE do read the posting guide
>>><http://www.R-project.org/posting-guide.html>http://www.R-project.org/posting-guide.html
>>>
>>>and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]