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, [email protected] wrote:
> Send R-lang mailing list submissions to
>       [email protected]
> 
> 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
>       [email protected]
> 
> You can reach the person managing the list at
>       [email protected]
> 
> 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 <[email protected]>
> Subject: [R-lang] wonky PDF labelling behavior in R
> To: [email protected]
> Message-ID: <[email protected]>
> 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
> [email protected]
> http://pidgin.ucsd.edu/mailman/listinfo/r-lang
> 
> 
> End of R-lang Digest, Vol 25, Issue 3
> *************************************


_______________________________________________
R-lang mailing list
[email protected]
http://pidgin.ucsd.edu/mailman/listinfo/r-lang

Reply via email to