[R] A problem with plotting a long expression in ylab ?
Paul Murrell
p.murrell at auckland.ac.nz
Wed Sep 29 21:32:27 CEST 2010
Hi
On 29/09/2010 8:17 p.m., Tal Galili wrote:
> My honor.
>
> A short question: if there is something in the device that is sensitive
> to the overlapping of the text, then is it possible to add a warning
> massage output when the length of the text is longer then the device
> dimensions?
The graphics engine does a lot of this sort of clipping (not just text),
but all of it is silent. You certainly wouldn't want to print all
clipping warnings to screen and there is no current plan to return
clipping information from the graphics engine. The current expectation
is that the interested useR/developeR will use the R-level tools, such
as strwidth(), to check for overlap, etc.
Paul
> With much respect,
> Tal
>
> ----------------Contact
> Details:-------------------------------------------------------
> Contact me: Tal.Galili at gmail.com <mailto:Tal.Galili at gmail.com> |
> 972-52-7275845
> Read me: www.talgalili.com <http://www.talgalili.com> (Hebrew) |
> www.biostatistics.co.il <http://www.biostatistics.co.il> (Hebrew) |
> www.r-statistics.com <http://www.r-statistics.com> (English)
> ----------------------------------------------------------------------------------------------
>
>
>
>
> On Wed, Sep 29, 2010 at 1:24 AM, Paul Murrell <p.murrell at auckland.ac.nz
> <mailto:p.murrell at auckland.ac.nz>> wrote:
>
> Hi
>
> It is a bug. A fix has been committed.
>
> Thanks for the report!
>
> Paul
>
>
> On 29/09/2010 10:15 a.m., Ben Bolker wrote:
>
> Barry Rowlingson<b.rowlingson<at> lancaster.ac.uk
> <http://lancaster.ac.uk>> writes:
>
> My point is that in regular text, ylab plots it where it
> then goes outside
> the borders.
> With the use of expressions - the text just doesn't show up.
> Originally I thought it was because of my miss-use of
> expressions, until I
> figured it was the level of cex.lab I was using.
> The problem is that when you can't see the text, you
> don't have a sense of
> how much to decrease the cex.lab so the text will fit.
> I hope I was now clearer.
>
>
> Gotcha. Seems to only affect ylab though. Do this:
>
> > t = expression(paste("test
> loooooooooooooooooooooooooooooooooooooooooooooo(% of 360"
> *degree,
> ")"))
> > plot(1,xlab=t,ylab=t,main=t)
>
> then if I shrink my graphics window I can make the ylab
> disappear but
> not the xlab or title.
>
> Seems to affect any rotated expressions:
>
> plot(1)
> text(1,1,t,srt=90)
> text(1,1,t,srt=0)
> text(1,1,t,srt=45)
>
>
> Now shrink window and watch the rotated expressions
> vanish! They
> disappear when they start (or finish) out of the entire graphics
> device, not the plot region...
>
> I cant find anything relating to clipping in the help, and
> I am on
> Linux, so see if there's any news about it, try it with
> R-patched or
> R-devel and then report a bug after having read all the
> other stuff
> about R bug reporting!
>
> Barry
>
>
>
> I don't claim to understand it, but there is something quite
> fundamental about the properties of the X11() graphics device in R
> that makes labels that would otherwise overlap, disappear -- if
> you do 'extreme resizing' with the graphics above, you can see that
> otherwise-overlapping x- and y-axis tick labels disappear as the
> graph gets scrunched. This is (apparently) true of X11 graphics
> on MacOS as well -- Quartz window has a different behavior.
> Trying with pdf() as well -- for height=2, width=2, only 1 y-axis
> and 2 x-axis tick labels survive, *but* the x and y labels and the
> title are all still present (but clipped, of course).
> [Hmmm. Take my reports above with a grain of salt, I wasn't
> always using expression()s.]
>
> So I would guess that if you reported this as a bug you would
> be told that it was a poorly documented property of R's X11
> graphics model, rather than a bug ...
>
> I have no idea where to start looking for more information
> about what defines this behavior -- if I were desperate to know
> I would probably try asking Paul Murrell ...
>
> I would be very interested to see this discussed on r-devel,
> if anyone bit ...
>
> Ben Bolker
>
> ______________________________________________
> R-help at r-project.org <mailto: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 Paul Murrell
> Department of Statistics
> The University of Auckland
> Private Bag 92019
> Auckland
> New Zealand
> 64 9 3737599 x85392
> paul at stat.auckland.ac.nz <mailto:paul at stat.auckland.ac.nz>
> http://www.stat.auckland.ac.nz/~paul/
>
>
> ______________________________________________
> R-help at r-project.org <mailto: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 Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/
More information about the R-help
mailing list