[R] Sweave PDF files show plot symbols as "q"
Gavin Simpson
gavin.simpson at ucl.ac.uk
Wed Jun 30 15:27:47 CEST 2010
On Wed, 2010-06-30 at 13:26 +0100, Allan Engelhardt wrote:
> A simpler option is probably to put
>
> <<echo=FALSE>>=
> pdf.options(useDingbats = FALSE)
> @
Hi Allan,
You're on Linux, so is there a reason why this won't work in a shell:
touch ~/.fonts.conf
vim ~/.fonts.conf
replace vim with your favourite editor, and then paste in the lines
suggested in ?pdf, save and then start R.
For your clients; can't you just email them the file and get them to
save it as ~/.fonts.conf. If they are running Linux themselves they
should be able to manage that. If they are on Windows, this isn't an
issue for them, just for your system; note that it is the rendering on
*your* system that is problematic. Try opening the problematic pdf in
Adobe Reader on your Linux box and it renders it just fine. The same
should be true on Windows.
That config file solves the problem for all uses of R on my Linux box,
and as this configuration file is in my home folder it is local to me
and doesn't require root permissions which may be a problem if the
machine you are running this on is not 'owned' by you.
That way you wouldn't have to remember to set the use of dingbats and
can benefit from the improved rendering dingbats provides.
HTH
G
>
> near the top of the Sweave document.
>
> Thanks again!
>
> > Thank you Gavin, this is useful. The work-around for me then is to
> > quickly run
> >
> > pdf("test.pdf")
> > plot(0:25, pch=0:25)
> > dev.off()
> >
> >
> > to see which "pch" values are not safe (unsafe.pch <- c(1, 10, 13, 16,
> > 19, 20, 21)) and make sure I never use them. (The first four, btw.,
> > corresponds to the symbols that are different in S and R.)
> >
> > This should be feasible, if somewhat tedious to test. Does anybody
> > know of a way to get R to stop if a 'pch' value in this list is ever
> > being used?
> >
> > Changing configuration files on clients' systems in three continents
> > isn't really an option. They expect it to "just work" when they click
> > on the file. I guess I could always downgrade to SPSS or
> > something.... :-)
> >
> > Thanks again
> >
> > Allan
> >
> >
> > On 30/06/10 12:05, Gavin Simpson wrote:
> >> On Wed, 2010-06-30 at 10:19 +0100, Allan Engelhardt wrote:
> >>> I'm guessing this is a FAQ but I can't find it and that it is probably
> >>> not exclusive R related but relevant so I thought I'd ask:
> >>>
> >>> When I view the PDF output from Sweave (e.g. Example 1 from the
> >>> author's
> >>> web site at [1]) on a Linux system using the standard PDF viewer [2],
> >>> the circles for the outliers in the plot [boxplot(Ozone ~ Month, data =
> >>> airquality)] show up as the letter 'q'.
> >>>
> >>> [...]
> >>>
> >>> I need to generate reports from R that work (=look the same) across
> >>> platforms: does anybody have a suggestion for a workaround?
> >> See ?pdf particularly the Notes section, which has:
> >>
> >> On some systems the default plotting character ‘pch = 1’ is
> >> displayed in some PDF viewers incorrectly as a ‘"q"’ character.
> >> (These seem to be viewers based on the ‘poppler’ PDF rendering
> >> library). This may be due to incorrect or incomplete mapping of
> >> font names to those used by the system. Adding the following
> >> lines to ‘~/.fonts.conf’ or ‘/etc/fonts/local.conf’ may circumvent
> >> this problem.
> >>
> >>
> >>
> >> <alias binding="same">
> >> <family>ZapfDingbats</family>
> >> <accept><family>Dingbats</family></accept>
> >> </alias>
> >>
> >> HTH
> >>
> >> G
> > [...]
> >
> > ______________________________________________
> > R-help at 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-help at 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.
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the R-help
mailing list