Hi all, I am trying to do something simple, but which is deviling me. I want to add an up-arrow to the x-axis, pointing to a specific location on the axis. I want the arrow to be as large as possible. Here is where I'm at with my code: #this part if from the ?plot example: require(stats) plot(cars) lines(lowess(cars)) #I am trying to use mtext to add the arrow... but I don't know how to do it: mtext("?", side = 1, line = 0, at = 7) #that question mark is a place-holder for the arrow. How do I put an up-arrow there instead of the question mark -- as large as possible? Many thanks to all of you in advance. ----------------------------------- Josh Banta, Ph.D Center for Genomics and Systems Biology New York University 100 Washington Square East New York, NY 10003 Tel: (212) 998-8465 http://plantevolutionaryecology.org [[alternative HTML version deleted]]
Barry Rowlingson
2010-Oct-06 09:00 UTC
[R] Pointing to a specific place on the x-axis with an arrow
On Wed, Oct 6, 2010 at 1:45 AM, Josh B <joshb41 at yahoo.com> wrote:> Hi all, > > I am trying to do something simple, but which is deviling me. I want to add an > up-arrow to the x-axis, pointing to a specific location on the axis. I want the > arrow to be as large as possible. > > Here is where I'm at with my code: > > #this part if from the ?plot example: > require(stats) > plot(cars) > lines(lowess(cars)) > #I am trying to use mtext to add the arrow... but I don't know how to do it: > mtext("?", side = 1, line = 0, at = 7) > #that question mark is a place-holder for the arrow. How do I put an up-arrow > there instead of the question mark -- as large as possible?Use %up% in an expression - but I think it needs two empty {} expressions as arguments: mtext(expression({}%up%{}), side = 1, line = 0, at = 12) Looks pretty good... Barry -- blog: http://geospaced.blogspot.com/ web: http://www.maths.lancs.ac.uk/~rowlings web: http://www.rowlingson.com/ twitter: http://twitter.com/geospacedman pics: http://www.flickr.com/photos/spacedman
Michael Bedward
2010-Oct-06 09:09 UTC
[R] Pointing to a specific place on the x-axis with an arrow
Hi Josh, Try this... mtext(expression(symbol("\255")), side=1, line=0, at=7) Michael On 6 October 2010 11:45, Josh B <joshb41 at yahoo.com> wrote:> Hi all, > > I am trying to do something simple, but which is deviling me. I want to add an > up-arrow to the x-axis, pointing to a specific location on the axis. I want the > arrow to be as large as possible. > > Here is where I'm at with my code: > > #this part if from the ?plot example: > require(stats) > plot(cars) > lines(lowess(cars)) > #I am trying to use mtext to add the arrow... but I don't know how to do it: > mtext("?", side = 1, line = 0, at = 7) > #that question mark is a place-holder for the arrow. How do I put an up-arrow > there instead of the question mark -- as large as possible? > > Many thanks to all of you in advance. > ----------------------------------- > Josh Banta, Ph.D > Center for Genomics and Systems Biology > New York University > 100 Washington Square East > New York, NY 10003 > Tel: (212) 998-8465 > http://plantevolutionaryecology.org > > > > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > 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. >