Re: [R] Histogram inset into another histogram

From: Paul Hiemstra <p.hiemstra_at_geo.uu.nl>
Date: Thu, 19 Jun 2008 13:57:36 +0200

Victor Homar wrote:
> Dear R users and helpers,
>
> I'm trying to find an example of a histogram plot as an inset (upper
> right or left corner) of another histogram.
>
> Anyone has an example of that?
>
> Thanks for your help,
>
> Víctor.
>
Hi,

You can use the histogram function from the lattice package (standard in R) in combination with the print statement. Example:

library(lattice)
h = histogram(cars$speed)
h2 = histogram(cars$speed, xlab = "", ylab="") print(h, more = T)
print(h2, position = c(.05,.65,.5,.95))

The position argument in print gives the bounding box for the lattice object. The coordinate system is c(x1,y1,x2,y2) where (x1,y1) is the bottom left corner and (x2,y2) is the top right corner. The coordinate system runs from (0,0) in the bottom left corner to (1,1) in the top right corner.

hth and cheers,
Paul

-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: 	+31302535773
Fax:	+31302531145
http://intamap.geo.uu.nl/~paul

______________________________________________
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.
Received on Thu 19 Jun 2008 - 12:07:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 19 Jun 2008 - 14:30:43 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive