First, I also have problem using ggplot2 to draw inset plot for log scale.
However, I have done some work before using viewport from grid package.
The description of viewport
:
These functions create viewports, which describe rectangular regions on a graphics device and define a number of coordinate systems within those regions.
Basically you can overlap one plot upon another and one upon another...
(1) You can uncomment the command so you can output to a png easily or use dev.copy2**
etc.
(2) x,y,width,height can be specified as unit
object, more info about grid::unit, click here
require(grid)
require(ggplot2)
p = qplot(1:10, 1:10, log="x")
g = qplot(0.1 , 0.1)
vp1 <- viewport(width = 0.3,
height = 0.3,
x = 0.4,
y = 0.7)
vp2 <- viewport(width = 0.3,
height = 0.3,
x = 0.8,
y = 0.3)
#png("text.png")
print(p)
print(g, vp = vp1)
print(g, vp = vp2)
#dev.off()