Hi, Can you please help me with the following output formatting: I am planning to include 2 plots and some general description in a one-page PDF document, such that - I'll leave some appropriate margin on the PDF- say, 1.5 inches top,right, bottom and left (will decide based on overall appearance) - the 2 plots are placed side-by-side (looks best for comparison) - the margins for each plot can be 4 lines on the top and the bottom & 2 lines on the left and the right - each of these 2 plots would have time (0 to 260) along x-axis and two time-series (daily USD-GBP and USD-EUR FX rates) on the y-axis, i.e. 2 time-series would be plotted on each of the 2 graphs. I would need a different color for each plot to demarcate them - I need to add some text (eg: "Independent analysis of Exchange Rate dynamics") with reduced font size (not high priority though-just good to have a different size) - The general discussion (may be a paragraph) would come right below the 2 plots - I can specify this text as an argument in a function, may be. I am not sure how to arrange the entire PDF as per the format I mentioned above I shall really appreciate any help with this - the time series analysis is not difficult, I can manage that - however, I don't know how to manage the formatting part though, so that the 1-pager output looks decently presentable. Thanks. Regards, Preetam [[alternative HTML version deleted]]
On Tue, 11 Oct 2016, Preetam Pal <lordpreetam at gmail.com> writes:> Hi, > > Can you please help me with the following output formatting: > I am planning to include 2 plots and some general description in a one-page > PDF document, such that > > - I'll leave some appropriate margin on the PDF- say, 1.5 inches > top,right, bottom and left (will decide based on overall appearance) > - the 2 plots are placed side-by-side (looks best for comparison) > - the margins for each plot can be 4 lines on the top and the bottom & > 2 lines on the left and the right > - each of these 2 plots would have time (0 to 260) along x-axis and two > time-series (daily USD-GBP and USD-EUR FX rates) on the y-axis, i.e. 2 > time-series would be plotted on each of the 2 graphs. I would need a > different color for each plot to demarcate them > - I need to add some text (eg: "Independent analysis of Exchange Rate > dynamics") with reduced font size (not high priority though-just good to > have a different size) > - The general discussion (may be a paragraph) would come right below the > 2 plots - I can specify this text as an argument in a function, may be. I > am not sure how to arrange the entire PDF as per the format I mentioned > above > > I shall really appreciate any help with this - the time series analysis is > not difficult, I can manage that - however, I don't know how to manage the > formatting part though, so that the 1-pager output looks decently > presentable. Thanks. > > Regards, > PreetamIf using LaTeX is an option, I would suggest ?Sweave. There are many tutorials on the web that should get you started. -- Enrico Schumann Lucerne, Switzerland http://enricoschumann.net
Hey Enrico, LaTex is not possible actually. On Tue, Oct 11, 2016 at 2:29 PM, Enrico Schumann <es at enricoschumann.net> wrote:> On Tue, 11 Oct 2016, Preetam Pal <lordpreetam at gmail.com> writes: > > > Hi, > > > > Can you please help me with the following output formatting: > > I am planning to include 2 plots and some general description in a > one-page > > PDF document, such that > > > > - I'll leave some appropriate margin on the PDF- say, 1.5 inches > > top,right, bottom and left (will decide based on overall appearance) > > - the 2 plots are placed side-by-side (looks best for comparison) > > - the margins for each plot can be 4 lines on the top and the bottom & > > 2 lines on the left and the right > > - each of these 2 plots would have time (0 to 260) along x-axis and > two > > time-series (daily USD-GBP and USD-EUR FX rates) on the y-axis, i.e. 2 > > time-series would be plotted on each of the 2 graphs. I would need a > > different color for each plot to demarcate them > > - I need to add some text (eg: "Independent analysis of Exchange Rate > > dynamics") with reduced font size (not high priority though-just good > to > > have a different size) > > - The general discussion (may be a paragraph) would come right below > the > > 2 plots - I can specify this text as an argument in a function, may > be. I > > am not sure how to arrange the entire PDF as per the format I > mentioned > > above > > > > I shall really appreciate any help with this - the time series analysis > is > > not difficult, I can manage that - however, I don't know how to manage > the > > formatting part though, so that the 1-pager output looks decently > > presentable. Thanks. > > > > Regards, > > Preetam > > If using LaTeX is an option, I would suggest > ?Sweave. There are many tutorials on the web that > should get you started. > > > -- > Enrico Schumann > Lucerne, Switzerland > http://enricoschumann.net >-- Preetam Pal (+91)-9432212774 M-Stat 2nd Year, Room No. N-114 Statistics Division, C.V.Raman Hall Indian Statistical Institute, B.H.O.S. Kolkata. [[alternative HTML version deleted]]
Or package "knitr". Note that knitr can be used with LaTeX or markdown syntax, but from your description the former would be advised. -- Sent from my phone. Please excuse my brevity. On October 11, 2016 1:59:59 AM PDT, Enrico Schumann <es at enricoschumann.net> wrote:>On Tue, 11 Oct 2016, Preetam Pal <lordpreetam at gmail.com> writes: > >> Hi, >> >> Can you please help me with the following output formatting: >> I am planning to include 2 plots and some general description in a >one-page >> PDF document, such that >> >> - I'll leave some appropriate margin on the PDF- say, 1.5 inches >> top,right, bottom and left (will decide based on overall >appearance) >> - the 2 plots are placed side-by-side (looks best for comparison) >> - the margins for each plot can be 4 lines on the top and the >bottom & >> 2 lines on the left and the right >> - each of these 2 plots would have time (0 to 260) along x-axis >and two >> time-series (daily USD-GBP and USD-EUR FX rates) on the y-axis, >i.e. 2 >> time-series would be plotted on each of the 2 graphs. I would need >a >> different color for each plot to demarcate them >> - I need to add some text (eg: "Independent analysis of Exchange >Rate >> dynamics") with reduced font size (not high priority though-just >good to >> have a different size) >> - The general discussion (may be a paragraph) would come right >below the >> 2 plots - I can specify this text as an argument in a function, >may be. I >> am not sure how to arrange the entire PDF as per the format I >mentioned >> above >> >> I shall really appreciate any help with this - the time series >analysis is >> not difficult, I can manage that - however, I don't know how to >manage the >> formatting part though, so that the 1-pager output looks decently >> presentable. Thanks. >> >> Regards, >> Preetam > >If using LaTeX is an option, I would suggest >?Sweave. There are many tutorials on the web that >should get you started.
Hi There is also the basic option of using the grid package and viewports. You can then place the plots where you want and annotate them pdf(file = paste0("01", ".pdf"), height = 3.5, width = 7, paper = "special", onefile = TRUE, family = "Helvetica", pointsize = 12, colormodel = "rgb") vpl <- viewport(x = 0.25, y = 0.5, width = 0.45, height = 0.9) pushViewport(vpl) grid.rect(gp = gpar(lty = "dashed")) popViewport() vpr <- viewport(x = 0.75, y = 0.5, width = 0.45, height = 0.9) pushViewport(vpr) grid.rect(gp = gpar(lty = "dashed")) grid.circle(x = 0.6, y = 0.4, r = 0.3) popViewport() dev.off() In your case you may need to have a viewport of the whole page see http://www.amstat.org/publications/jse/v18n3/zhou.pdf for examples also have a look at the grid.clip function Regards Duncan Mackay Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mackay at northnet.com.au -----Original Message----- From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Preetam Pal Sent: Tuesday, 11 October 2016 19:14 To: r-help at r-project.org Subject: [R] Output formatting in PDF Hi, Can you please help me with the following output formatting: I am planning to include 2 plots and some general description in a one-page PDF document, such that - I'll leave some appropriate margin on the PDF- say, 1.5 inches top,right, bottom and left (will decide based on overall appearance) - the 2 plots are placed side-by-side (looks best for comparison) - the margins for each plot can be 4 lines on the top and the bottom & 2 lines on the left and the right - each of these 2 plots would have time (0 to 260) along x-axis and two time-series (daily USD-GBP and USD-EUR FX rates) on the y-axis, i.e. 2 time-series would be plotted on each of the 2 graphs. I would need a different color for each plot to demarcate them - I need to add some text (eg: "Independent analysis of Exchange Rate dynamics") with reduced font size (not high priority though-just good to have a different size) - The general discussion (may be a paragraph) would come right below the 2 plots - I can specify this text as an argument in a function, may be. I am not sure how to arrange the entire PDF as per the format I mentioned above I shall really appreciate any help with this - the time series analysis is not difficult, I can manage that - however, I don't know how to manage the formatting part though, so that the 1-pager output looks decently presentable. Thanks. Regards, Preetam [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.