[Rd] plot ignores type= "n" when x is factor (PR#13703)
Paul Johnson
pauljohn32 at gmail.com
Tue May 26 18:58:18 CEST 2009
On Tue, May 26, 2009 at 3:11 AM, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote:
> On Thu, 14 May 2009, pauljohn at ku.edu wrote:
>
>> Full_Name: Paul E. Johnson
>> Version: 2.9.1
>
> Where did you get that? Time travel?
>
No, actually. I used time travel to return to the present and
pre-maturely file the bug report :)
I knew the problem would still be there in 2.9.1 and I came back to
try to warn you about it.
>>
>> x <- gl(2,50)
>> y <- rnorm(100)
>> plot(x,y)
>> plot(x,y, type="n")
>>
>>
>> I *wish* the last one would draw a blank plot box w/axes, but it does not.
>> It
>> fills in the middle with a box plot. I've not seen this problem when x is
>> numeric.
>
> Because this is a call to the 'factor' (see ?plot.factor). Although ?plot
> says
>
> ...: Arguments to be passed to methods, such as graphical
> parameters (see 'par'). Many methods will accept the
> following arguments:
>
> 'type' what type of plot should be drawn. Possible types are
>
> 'many' does not mean 'all' and all the other values of 'type' would be
> inappropriate for plot.factor. Note that plot.factor is a wrapper for a
> call to barplot(), spineplot() or (in your case) boxplot(), which do not
> take a 'type' argument.
>
> If plot.factor() or barplot() or boxplot() allowed a 'type' argument, what
> value would be appropriate to give the usual plot? Not as far as I can see
> any of those listed in ?plot, and that says all other values are errors.
>
>
> So, this is not a bug, it was not marked for the wishlist (see the R FAQ),
> and there seems no simple way to accommodate the implicit wish.
>
> -
Please look at this from the user's point of view.
There's no mention of plot.factor in the plot help page. Aside from
reading the source code of the plot function (or your email), I don't
think a user would know that plot.factor is even involved in plot.
How about inserting this at the top of the help page for plot:
If either x or y is a factor variable, the plot.factor method is
called to determine the sort of graph to be drawn. If x and y are both
numeric, the type argument determines the sort of graph to be drawn.
If you did that, then you could answer my bug report with the
criticism that I did not read ?plot.factor or that plot.factor can't
do what I want. Otherwise, your response seems unkind and somewhat
unreasonable. I have no way of knowing that plot.factor is even
involved when I try to use the plot function.
pj
--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas
More information about the R-devel
mailing list