I want to plot a shapefile and add a colorbar beside. I added the coloarbar by the following code.
image.plot(legend.only = TRUE, zlim = c(0, 1000),
col = colorbar, nlevel = 4, horizontal = FALSE, legend.shrink = 0.7)
My problem is like the figure below, the colorbar interacts with the plot.

Then I found some solution to move the colorbar by
image.plot(legend.only = TRUE, zlim = c(0, 1000),
col = colorbar, nlevel = 4, horizontal = FALSE, legend.shrink = 0.7, smallplot = c(0.95, 0.99, 0.3, 0.7))
But now it becomes this, right now I cannot even see the numbers.

Is there any way to move the plot a little left, so that there is some place for the colorbar? Or is there any way to expand the drawing panel to place the colorbar? Thank you.
Adjust the oma for the image and the legend. Here's an example:
data:
structure(c(1.75267599319517, 1.94305075507445, -0.156487381738027,
0.445640426661944, 1.47524414033855, 1.02750392394893, -1.22677726427257,
0.328939164881444, 1.8373305915836, -2.60705394935169, -0.176565075649185,
0.686525129060304, -0.270880825694669, 0.228427158100646, 0.296087431746941,
0.159733127698645, -0.335874862599458, -1.48189689355783, 2.28164829999553,
-0.221602702990901, -1.19118638639445, -0.669176494493408, 0.146646167689706,
-0.356170596317782, -1.25338279788711, 1.590956130167, -0.0859783795499388,
1.28699804800428, 0.673030469365775, 1.50431821599456, -0.0415374929905405,
-1.66641620237076, -0.466513627830826, 0.224700229437091, -0.0935518596695337,
1.77372649149139, -0.324986645432598, -0.717452050358237, -0.652792543676794,
-0.63363234302696, -1.33373586598015, 0.287736774848359, -2.0047033043693,
-0.169110483354588, -1.00746374158438, 1.09791123137282, 0.835200025940813,
1.49766948516664, -0.372579472535408, 0.0928212636896341, -0.596541205386888,
-2.08914364716957, -0.0329161555494402, 0.0469126764319172, 0.901591475473942,
-1.81735802943062, 0.0116636902497983, -0.857668758902046, -0.0123288459943967,
-2.06908827360805, -2.04305175171055, 0.230800348099395, -0.548843960606738,
0.42156183975044, 0.0374174028221, -0.564919467814281, -1.48228025377204,
-0.687727667103207, 1.28230405559294, 0.680295500103408, -2.14368865783057,
0.259858393651711, -1.01732304373518, -0.0188730011118445, -0.386878321355593,
-0.810280425180489, 0.706333208066621, 0.783769913289453, -0.245972056614985,
0.216018643466252, -0.721116233056827, 1.4782390752923, -2.08847116325789,
0.924181052813952, 0.740754382565328, 0.537848528023596, -1.40878671892895,
-0.0870042863455953, 0.797988334415009, -0.601329461472177, -1.15426452376043,
1.28814038900589, -0.997765393519507, 1.09387671511455, 0.599442343976457,
0.323252016862286, -0.338054796460218, 1.60358639606103, -0.836761687404309,
0.224602950250348, 0.457867653133552, 0.111812983058114, -1.94611223307409,
0.816617488615419, 0.803506493408523, -3.27213559068651, 0.914990262538904,
1.04878880717756, 1.02930117080295, -0.780637711297084, -1.63107614827176,
-0.780474130437691, 1.75029718369322, 0.896818981075001, -0.388043322063959,
-0.472369396803673, 0.949964242662063, -0.665981283816353, 1.14546357500757,
-0.149619678444026, 1.31405614654295, -0.916785592776755, 0.595768148350207,
0.554906368528589, -0.64216913243052, -0.141294344542147, -1.10328974307499,
-0.0523192529246229, -0.16760238083543, -2.21744159323307, 0.293362942177156,
-0.198123321190054, -1.27367916442953, 1.3475805394527, 0.379260832421235,
-1.21921905754775, -0.715980480102964, -0.719626343992431, 1.1512160588389,
-0.84503724263784, -1.79029200798331, 1.00839282965634, 1.8043734147227,
-1.0819177220181, -0.200947360793273, -0.30353527334045, 0.444037029616591,
-0.478592762144137, 0.834712578703853, -0.119438685285821), .Dim = c(10L, 15L))
Set 4 lines for right side margin:
par(oma=c(0,0,0,4))
image(data)
Reset outside margin for right side before plotting legend:
par(oma=c( 0,0,0,1))
image.plot( legend.only=TRUE, zlim=c(-4,4))

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With