Image with GMT colour scheme.

library(oce)
## Loading required package: gsw
## Loading required package: testthat
data(topoWorld)
imagep(topoWorld, colormap=colormap(name="gmt_globe"))

Mean height across longitude: use the powerful apply() function.

## extract data to clarify code
Latitude <- topoWorld[["latitude"]]
Longitude <- topoWorld[["longitude"]]
z <- topoWorld[["z"]]
# Use apply() to apply the mean() function across the 2nd coordinate
mean <- apply(z, 2, mean)
# Plot, using type='l' for lines 
plot(mean, Latitude, xlab="Mean height [m]", type='l')