Frank Bloos
2009-Jul-23 06:18 UTC
[R] Antw: How to extract the upper xlim and ylim of my plot?
You may want to use the function corner.label from the plotrix-package. Frank>>> Mark Na <mtb954@gmail.com> 21.07.2009 23:03 >>>Dear R-helpers, I wish to place some text in a plot, at approx 10% of my upper xlim and approx 90% of my upper ylim, i.e.> plot(log(all$SR,10)~log(all$AREA,10)) > text(.1*max(xlim),.9*max(ylim),"text to be placed")(I know how to give absolute coordinates for text location, but I wish to use relative coordinates). My code (above) doesn't work because I don't know how to properly extract the upper xlim and ylim values. Does anyone know how I could extract the upper xlim and ylim values (without using max(x-variable) or max (y-variable)...I wish to keep this as general as possible and not point to the original data. Thanks in advance, Mark [[alternative HTML version deleted]] ____________________ Universitätsklinikum Jena Körperschaft des öffentlichen Rechts und Teilkörperschaft der Friedrich-Schiller-Universität Jena Bachstraße 18, 07743 Jena Verwaltungsratsvorsitzender: Prof. Dr. Walter Bauer-Wabnegg; Medizinischer Vorstand: Prof. Dr. Klaus Höffken; Wissenschaftlicher Vorstand: Prof. Dr. Klaus Benndorf; Kaufmännischer Vorstand und Sprecher des Klinikumsvorstandes Rudolf Kruse Bankverbindung: Sparkasse Jena; BLZ: 830 530 30; Kto.: 221; Gerichtsstand Jena Steuernummer: 161/144/02978; USt.-IdNr. : DE 150545777 [[alternative HTML version deleted]]
Uwe Ligges
2009-Jul-23 09:09 UTC
[R] Antw: How to extract the upper xlim and ylim of my plot?
Frank Bloos wrote:> You may want to use the function corner.label from the plotrix-package. > > Frank > >>>> Mark Na <mtb954 at gmail.com> 21.07.2009 23:03 >>> > Dear R-helpers, > > I wish to place some text in a plot, at approx 10% of my upper xlim > and > approx 90% of my upper ylim, i.e. > >> plot(log(all$SR,10)~log(all$AREA,10)) >> text(.1*max(xlim),.9*max(ylim),"text to be placed") > > (I know how to give absolute coordinates for text location, but I wish > to > use relative coordinates). > > My code (above) doesn't work because I don't know how to properly > extract > the upper xlim and ylim values. > > Does anyone know how I could extract the upper xlim and ylim values > (without > using max(x-variable) or max (y-variable)...I wish to keep this as > general > as possible and not point to the original data.For the original question see ?par and try par("usr") Uwe Ligges> Thanks in advance, > > Mark > > [[alternative HTML version deleted]] > > > > ____________________ > Universit??tsklinikum Jena > K??rperschaft des ??ffentlichen Rechts und Teilk??rperschaft der > Friedrich-Schiller-Universit??t Jena > Bachstra??e 18, 07743 Jena > Verwaltungsratsvorsitzender: Prof. Dr. Walter Bauer-Wabnegg; > Medizinischer Vorstand: Prof. Dr. Klaus H??ffken; > Wissenschaftlicher Vorstand: Prof. Dr. Klaus Benndorf; Kaufm??nnischer > Vorstand und Sprecher des Klinikumsvorstandes Rudolf Kruse > Bankverbindung: Sparkasse Jena; BLZ: 830 530 30; Kto.: 221; > Gerichtsstand Jena > Steuernummer: 161/144/02978; USt.-IdNr. : DE 150545777 > > > [[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.
use hilox<-range.x=range(x variable) and hiloy<-range.y=range(y variable) or store these values in vectors to be later on user as xlim=hilox, ylim=hiloy Frank Bloos wrote:> > You may want to use the function corner.label from the plotrix-package. > > Frank > >>>> Mark Na <mtb954 at gmail.com> 21.07.2009 23:03 >>> > Dear R-helpers, > > I wish to place some text in a plot, at approx 10% of my upper xlim > and > approx 90% of my upper ylim, i.e. > >> plot(log(all$SR,10)~log(all$AREA,10)) >> text(.1*max(xlim),.9*max(ylim),"text to be placed") > > (I know how to give absolute coordinates for text location, but I wish > to > use relative coordinates). > > My code (above) doesn't work because I don't know how to properly > extract > the upper xlim and ylim values. > > Does anyone know how I could extract the upper xlim and ylim values > (without > using max(x-variable) or max (y-variable)...I wish to keep this as > general > as possible and not point to the original data. > > Thanks in advance, > > Mark > > [[alternative HTML version deleted]] > > > > ____________________ > Universit??tsklinikum Jena > K??rperschaft des ??ffentlichen Rechts und Teilk??rperschaft der > Friedrich-Schiller-Universit??t Jena > Bachstra??e 18, 07743 Jena > Verwaltungsratsvorsitzender: Prof. Dr. Walter Bauer-Wabnegg; > Medizinischer Vorstand: Prof. Dr. Klaus H??ffken; > Wissenschaftlicher Vorstand: Prof. Dr. Klaus Benndorf; Kaufm??nnischer > Vorstand und Sprecher des Klinikumsvorstandes Rudolf Kruse > Bankverbindung: Sparkasse Jena; BLZ: 830 530 30; Kto.: 221; > Gerichtsstand Jena > Steuernummer: 161/144/02978; USt.-IdNr. : DE 150545777 > > > [[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. > >-- View this message in context: http://www.nabble.com/Antw%3A--How-to-extract-the-upper-xlim-and-ylim-of-my-plot--tp24619947p24757330.html Sent from the R help mailing list archive at Nabble.com.