[R] legend issues.

David Winsemius dwinsemius at comcast.net
Mon Feb 25 22:18:43 CET 2013


My point is that you _still_ have not adhered to the Posting Guide request for sessionInfo() ... I say again. Please read the Posting Guide ... AND PLEASE STOP posting formatted email.

-- 
David.

On Feb 25, 2013, at 10:20 AM, Nicole Ford wrote:

> I did look at ??pie  ??graphics, as per my reply.  which netted nothing of value.
> 
> thanks.
> ~Nicole Ford
> Ph.D. student
> Graduate Assistant/ Instructor
> University of South Florida
> Government and International Affairs
> office: SOC 012M
> e: nmhicks at mail.usf.edu
> http://gia.usf.edu/student/nford/
> 
> 
> 
> 
> 
> 
> On Feb 25, 2013, at 12:38 PM, David Winsemius wrote:
> 
>> 
>> On Feb 25, 2013, at 7:37 AM, Nicole Ford wrote:
>> 
>>> hello, all.
>>> 
>>> one of my students is having an issue with the pie & legend function.
>>> 
>>> this is her code.  (below)
>>> 
>>> it works just fine for me.
>>> 
>>> her error is "plot.new has not been called yet".  i know this means her pie chart is coming up blank so the legend will not work.
>> 
>> So at that point, why not issue the command:
>> 
>> plot.new()    # ?
>> 
>> Graphics problems can be very system specific. Follow-up should include a proper adherence to the Posting Guide advice about the necessary problem description. You should assist R help by first educating yourself and then giving your students proper training in how to construct questions for R-help.
>> 
>>> 
>>> according to ?graphics  this package *is* supposed to handle these functionalities.  however, when i tried to install it i get the following error:
>>> 
>>> Warning message:
>>> package Œgraphics‚ is not available (for R version 2.15.2) 
>> 
>> The graphics package is part of the base installation. As far as I know you cannot reinstall it. You would instead need to reinstall R if you thought her installation if R was corrupt.
>> 
>> -- 
>> David.
>> 
>>> 
>>> however, the ?graphics page shows it is indeed available for this version of R.
>>> 
>>> 
>>> Package:       graphics
>>> Version:       2.15.2
>>> Priority:      base
>>> Title:         The R Graphics Package
>>> Author:        R Core Team and contributors worldwide
>>> Maintainer:    R Core Team <R-core at r-project.org>
>>> Description:   R functions for base graphics
>>> Imports:       grDevices
>>> License:       Part of R 2.15.2
>>> Built:         R 2.15.2; ; 2012-10-26 16:14:39 UTC; unix
>>> 
>>> thoughts are greatly appreciated.
>>> 
>>> 
>>> 
>>>> strength <- factor(c(rep("8.0-9.9", 2), rep("7.0-7.9", 12), rep("6.0-6.9", 108)))
>>>> plot(strength, xlab="Earthquake Strength", ylab="Frequency")
>>>> histogram(strength, xlab="Earthquake Strength", ylab="Relative Frequency by Percentage")
>>>> pie(table(strength))
>>> legend("topright", title="Earthquake Strength", cex=0.6, pch=16, col=c("white", "blue", "red"), legend=c("6.0 to 6.9", "7.0 to 7.9", "8.0 to 8.9"), ncol=3)
>>> 
>> 
>> David Winsemius
>> Alameda, CA, USA
>> 
> 

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list