Re: [R] debug R device plot

2011-05-23 Thread cameron.bracken
Not sure if you ever figured this out, but I was just directed to this post.

You need to look for a file (it may not be in your project directory) that
contains ___LOCK in its file name and delete it.  filehash creates this to
prevent multiple writes to the same file at the same time and somehow it did
not get removed correctly. tikzDevice uses the filehash package to cache
font metrics and it must have gotten interrupted.

-Cameron

--
View this message in context: 
http://r.789695.n4.nabble.com/debug-R-device-plot-tp3403638p3545415.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] boxplot( ) headers with Greek letters, values, and text

2009-08-03 Thread cameron.bracken


Johnson, Roger W. wrote:
 
 Any suggestions on how I can produce the same title using the boxplot
 command?
 

If you use LaTeX you could try the tikzDevice package (
https://r-forge.r-project.org/projects/tikzdevice/ ).  In that case you
would use:

main = paste('\\mu =',mu,', \\lambda =',lambda,', truncation =',truncation,
', N_T =',n)

a full example is:

tikz('myplot.tex')
boxplot(rnorm(100), main = paste('\\mu =',mu,', \\lambda =',lambda,',
truncation =',truncation, ', N_T =',n))
dev.off()

And in a tex file:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\centering
\input{myplot.tex}
\caption{}
\end{figure}
\end{document}


and the symbols would get typeset by latex. 

- Cameron 

P.S. I am one of the authors of this package, so this post is a bit self
serving but we just released a beta version and are trying to get the word
out. 


-- 
View this message in context: 
http://www.nabble.com/boxplot%28-%29-headers-with-Greek-letters%2C-values%2C-and-text-tp24785201p24795386.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] Getting file name from pdf device?

2009-07-31 Thread cameron.bracken



Rainer M Krug-6 wrote:
 
 Hi
 
 IU would like to modify the dev.off function, so that it automatically
 compresses the created pdf.
 I am thinking of doing the following in the modified dev.off:
 
 1) Get the filename of the pdf device
 2) close the device by calling the original dev.off()
 3) compress the pdf file with a system call of pdftk.
 
 

If you are the one who initiated the pdf device shouldn't you know the name
of the file? in that case just do something like:

my.dev.off - function (file, which = dev.cur()) 
{
if (which == 1) 
stop(cannot shut down device 1 (the null device))
.Internal(dev.off(as.integer(which)))
#system call (or something similar)
system(paste('pdftk',file))
dev.cur()
}

fn - 'myplot.pdf'
pdf(fn)
#plot stuff
my.dev.off(fn)

-Cameron
-- 
View this message in context: 
http://www.nabble.com/Getting-file-name-from-pdf-device--tp24755915p24761759.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] xtable formatting: RED for negative numbers?

2009-07-29 Thread cameron.bracken


Ken-JP wrote:
 
 Is there a way to modify this code to generate RED numbers inside xtable
 for
 negative results in x.ts?
 


This post would probably have been better for R-help.  Anyway, you can do it
easily by modifying print.xtable.R in the xtable package.  If it is easier,
make a copy of that file, modify it, load the xtable package, then source
your modified version.   

Basically change line 227 from 

result[i] - gsub(-,$-$,result[i],fixed=TRUE)

to

result[i] - gsub(-,\\color{red}$-$,result[i],fixed=TRUE)

and then your code chunk becomes:

sample,echo=F,results=tex= 
library(xtable)
x.ts - ts(rnorm(100), start = c(1954, 7), frequency = 12)
x.table - xtable( x.ts, digits = 1 ) 
print( x.table, floating = FALSE, math.style.negative = TRUE) 
@ 

Here is the patch:  http://www.nabble.com/file/p24727150/print.xtable.R.diff
print.xtable.R.diff 
Here is the output I got: 
http://www.nabble.com/file/p24727150/xtable-red.pdf xtable-red.pdf 

- Cameron

P.S. You must use the color package in latex.
-- 
View this message in context: 
http://www.nabble.com/xtable-formatting%3A-RED-for-negative-numbers--tp24712208p24727150.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] Computer Modern

2009-07-24 Thread cameron.bracken



Mr Derik wrote:
 
 I am trying to use computer modern fonts in postscript files for a latex
 document. Ultimately I want to automate this through sweave. 
 

Hi There- 

I admit this is shameless self promotion but might I suggest the tikzDevice
package. I am one of the developers and we just pushed up a beta version to
r-forge that is quite usable.  It enables graphic output in pgf/tikz format
that can be directly imported into LaTeX.  The fonts in your graphic will
implicitly match that of your document.  It also works well with Sweave, you
can see examples in the vignette. 

Binary builds may not be available until tomorrow but you can install from
source 

svn checkout svn://svn.r-forge.r-project.org/svnroot/tikzdevice
R CMD INSTALL tikzdevice/pkg

then: 

vignette('tikzDevice')

-- 
View this message in context: 
http://www.nabble.com/Computer-Modern-tp24303553p24653180.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] Sweave: Howto write real TeX formula in plot

2009-05-15 Thread cameron.bracken


cls59 wrote:
 
 install.packages('pgfSweave',repos='http://www.rforge.net')
 

For others that are not on Linux. I would suggest using the r-forge site for
binary installation. The binaries on rforge.net are not completely up to
date in some cases. 

install.packages(pgfSweave, repos=http://R-Forge.R-project.org;)

Otherwise use if you are not on a Linux system:

install.packages('pgfSweave',repos='http://www.rforge.net',type='source')

-Cameron 

-- 
View this message in context: 
http://www.nabble.com/Sweave%3A-Howto-write-real-TeX-formula-in-plot-tp23127536p23565286.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] PGF Device

2009-05-07 Thread cameron.bracken


baptiste auguie-2 wrote:
 
 I think the pgfSweave project on R-forge is working on this (as far as  
 i know it currently relies on eps2pgf)
 

Hi-

I am one of the developers of pgfSweave.  This is correct, pgfSweave
currently relies on eps2pgf.  Our goal for the summer is to develop a pgf
device.  This will help with performance as well as the eps conversion
problems that some have referred to. 

-- 
View this message in context: 
http://www.nabble.com/PGF-Device-tp23406917p23436385.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] postscript printer breaking up long strings

2009-04-30 Thread cameron.bracken



Ted.Harding-2 wrote:
 
 In the graph shown in your URL above, the xlab and the ylab
 appear in their entirety, unbroken. So does the one plotted
 in the middle of the graph. I get the same when I run your code.
 

Hi-

I am one of the developers of pgfSweave. The problem (although it is
considered a feature) is this (from https://svn.r-project.org/R/trunk/NEWS):

NEW FEATURES (in 2.9.0)

o   pdf() and postscript() gain a 'useKerning' argument to place
strings using kerning (which had previously been ignored in
display but not in strwidth), based in part on an idea and
code from Ei-ji Nakama. The default is TRUE.

Kerning involving spaces is now ignored (it was previously
only used in the computation of string widths).

This is normally not a problem but converting to pgf and then to pdf causes
large gaps when the useKerning option is turned on. The following will cause
the long strings to not break.

  postscript('linebreaktest.eps',useKerning=FALSE) 
  plot(1,xlab='aReallyLongStringToSeeHowItBreaks', 
 ylab='aReallyLongStringToSeeHowItBreaks') 
  for(i in c(.6,1,1.4))text(i,i,'aReallyLongStringToSeeHowItBreaks') 
  dev.off()
 
Kerning will be turned off by default in the latest snapshot of pgfSweave.

-Cameron Bracken
-- 
View this message in context: 
http://www.nabble.com/postscript-printer-breaking-up-long-strings-tp23322197p23328500.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] changing Swaeve output settings for .pdf and .eps - is there a way?

2009-04-17 Thread cameron.bracken



markheckmann wrote:
 
 The pdf() settings do not affect Sweave settings when producing a .pdf
 graphic. How can I change the Sweave default settings to e.g. 3 inch?
 

Also, even if you set the width of your plot to 3 inches, the plot will be
expanded to 80% of the textwidth by default.  To disable this (i.e you set
width=3 and your plot is actually 3 inches) use 

\usepackage[nogin]{Sweave}.
  
You will have to copy Sweave.sty to your local directory or to your texmf
directory for this to work. 

-- 
View this message in context: 
http://www.nabble.com/changing-Swaeve-output-settings-for-.pdf-and-.eps---is-there-a-way--tp23078496p23091931.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] changing Swaeve output settings for .pdf and .eps - is there a way?

2009-04-17 Thread cameron.bracken



Duncan Murdoch-2 wrote:
 
 There are other ways to control the size:  it isn't always 80%.  I
 normally use something like \setkeys{Gin}{width=0.75\textwidth} to control
 it.  You can reset this a 
 number of times in the same document.  (Read the LaTeX docs for graphicx
 to see the other 
 keys that can be set.)
 

The reason I suggested using the nogin option is because the default
behavior has always seemed very unintuitive to me.  It seems that setting a
width and/or height parameter should be the only thing that needs to be done
to determine the size of the graphic.  I know this is documented but I think
it is overly confusing to a new user.   I know the first time I set width=3
and the plot still spanned 80% of the page threw me off. 
-- 
View this message in context: 
http://www.nabble.com/changing-Swaeve-output-settings-for-.pdf-and-.eps---is-there-a-way--tp23078496p23104267.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] I want to use Sweave, but only sometimes

2009-04-14 Thread cameron.bracken


cls59 wrote:
 
 Currently pgfSweave is only available from rforge.net and is very much in
 beta. 
 

Well, that said, you can install the latest build using:



install.packages(pgfSweave, repos=http://R-Forge.R-project.org;)


then for the documentation:


?pgfSweave

AND


vignette(pgfSweave)
-- 
View this message in context: 
http://www.nabble.com/I-want-to-use-Sweave%2C-but-only-sometimes-tp23026260p23033700.html
Sent from the R help mailing list archive at Nabble.com.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


Re: [R] I want to use Sweave, but only sometimes

2009-04-14 Thread cameron.bracken

P.S.  pgfSweave does include caching of figures as a feature. See the
vignette for details.

-- 
View this message in context: 
http://www.nabble.com/I-want-to-use-Sweave%2C-but-only-sometimes-tp23026260p23033731.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] Sweave

2009-02-03 Thread cameron.bracken


Kjetil Halvorsen wrote:
 
 The other problem refered to above comes from this source lines:
 
  bubble(NURE.orig, ppm, col = c(#00ff0088, #00ff0088))
 

You may have to escape the # character (i.e. put \# instead).  I know this
must be done for backslashes.
-- 
View this message in context: 
http://www.nabble.com/Sweave-tp21798204p21824498.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] using Sweave with a master file that has several iputted .tex files

2009-01-28 Thread cameron.bracken



Mark Wardle wrote:
 
 Using make means a build for a single chapter is cached unless the
 source file
 changes and so one can see the results of changes to one source file
 almost immediately.
 

The pgfSweave package is specifically designed for speeding up the
compilation time in large documents.  It is still in development (not on
CRAN) but might be worth checking out:

https://www.rforge.net/pgfSweave/

-Cameron Bracken
-- 
View this message in context: 
http://www.nabble.com/using-Sweave-with-a-master-file-that-has-several-iputted-.tex-files-tp21690580p21719963.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


[R] Calling a jar file with rJava

2009-01-25 Thread cameron.bracken

I want to call the jar file from R.  I want to be able to do this without
using system().  Normally a command line call would look like 

java -jar eps2pgf.jar -m directcopy myfile.eps

My question is: Can I call this program using the rJava package or any other
(command line options and all)?  I really know nothing about Java so any
pointers would be appreciated.  

Thanks

-Cameron Bracken
-- 
View this message in context: 
http://www.nabble.com/Calling-a-jar-file-with-rJava-tp21650356p21650356.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.