Remove white space around map




tightmap sets the axis limits to be tight around the map in the current axes. This eliminates or reduces the white border between the map frame and the axes box. Use axis auto to undo tightmap.


Display a map of Africa. Notice the white space between the map frame and the edge of the axes box.

axesm('miller','maplatlim',[-40 40],'maplonlim',[-20 60])
framem; gridm; mlabel; plabel
load coast
plotm(lat, long)

Now use tightmap to reduce the wasted space:


More About

expand all


The axis limits are fixed. If a change in the projection parameters changes the size or position of the map display within the projected coordinate system, execute tightmap again. Also note that tightmap needs to be re-applied following any call to setm that causes projected map objects to be re-projected.

The tightmap function performs no action on a 'globe' map axes.

Was this topic helpful?