[R-lang] wonky PDF labelling behavior in R (Paula Chesley)

Steven Piantadosi piantado at mit.edu
Fri Jul 24 13:38:16 PDT 2009


Hi Paula,

hist itself is a plotting function so you don't need to call plot on it.
Try something like 

pdf("/Users/pchesley/linguistics/research/memory/data/r/figs/
figure_2.pdf") % attached figure_2.pdf

hist(pct$V1, breaks = seq(0, 1, 0.05), xlab = "% of speakers having seen new word before", ylab = "number of new words", main=" ")

dev.off()

hist also returns info about the histogram (counts, the mids of the bars, etc), which you can use to do fancy
histogram plots if you want. You can read about them with ?hist. 

++Steve


On Fri, 2009-07-24 at 13:27 -0700, r-lang-request at ling.ucsd.edu wrote:
> Send R-lang mailing list submissions to
> 	r-lang at ling.ucsd.edu
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://pidgin.ucsd.edu/mailman/listinfo/r-lang
> or, via email, send a message with subject or body 'help' to
> 	r-lang-request at ling.ucsd.edu
> 
> You can reach the person managing the list at
> 	r-lang-owner at ling.ucsd.edu
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of R-lang digest..."
> 
> 
> Today's Topics:
> 
>    1. wonky PDF labelling behavior in R (Paula Chesley)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Fri, 24 Jul 2009 11:53:57 -0600
> From: Paula Chesley <ches0045 at umn.edu>
> Subject: [R-lang] wonky PDF labelling behavior in R
> To: r-lang at ling.ucsd.edu
> Message-ID: <154A54B4-B74E-4221-9CE8-65AC4B4246E1 at umn.edu>
> Content-Type: text/plain; charset="us-ascii"; Format="flowed";
> 	DelSp="yes"
> 
> Hi everyone,
> 
> When trying to plot a pdf of a certain linguistic distribution, I am  
> having trouble having the labels I give as arguments show up in the  
> PDF. What shows up in the PDF are the unhelpful default labels R  
> gives. This is really strange, because I've done the same thing  
> several times no problem, and on the default x11 output the correct  
> labels show up. See attached figure 1 (correct labelling on x11) and  
> figure 2 (unfortunate labelling in PDF). This happens when in both  
> GUI and command-line modes of R. I've shut down other R sessions, and  
> there's no possibility that the file is the wrong file, either.
> 
> Here is my code for creating the PDF file:
> 
>  > pdf("/Users/pchesley/linguistics/research/memory/data/r/figs/ 
> figure_2.pdf") % attached figure_2.pdf
>  > plot(hist(pct$V1, breaks = seq(0, 1, 0.05)), xlab = "% of speakers  
> having seen new word before", ylab = "number of new words", main=" ")
>  > dev.off()
> 
> Can anyone tell me what's going on here? I'm flummoxed, and hoping  
> it's not painfully obvious. :)
> 
> Thanks,
> Paula
> 
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: figure_1.png
> Type: application/applefile
> Size: 72 bytes
> Desc: not available
> URL: <http://pidgin.ucsd.edu/pipermail/r-lang/attachments/20090724/20d49a5f/attachment.bin>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: figure_1.png
> Type: image/png
> Size: 225251 bytes
> Desc: not available
> URL: <http://pidgin.ucsd.edu/pipermail/r-lang/attachments/20090724/20d49a5f/attachment.png>
> -------------- next part --------------
> 
> 
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: figure_2.pdf
> Type: application/pdf
> Size: 5795 bytes
> Desc: not available
> URL: <http://pidgin.ucsd.edu/pipermail/r-lang/attachments/20090724/20d49a5f/attachment.pdf>
> -------------- next part --------------
> 
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> R-lang mailing list
> R-lang at ling.ucsd.edu
> http://pidgin.ucsd.edu/mailman/listinfo/r-lang
> 
> 
> End of R-lang Digest, Vol 25, Issue 3
> *************************************




More information about the R-lang mailing list