UltraPlot: colorbar padding is not working for outer top and outer bottom

Hi, I recently explored this project, and it works perfectly, especially for subplots spacing in figures using cartopy projections. My problem is that whether I removed the labels, gridlines, latitude/longitude labels the colorbar pad/space is not working for very small values (e.g. 0.001) for the locations of bottom and top. However, the padding works perfectly fine except bottom and top. I think, some bottom and top labels -does not matter invoked or not- preventing to use padding/spacing for small numbers

Does anyone know solution for this problem? Below you may see the colorbar for bottom and right positions and relevant script.

Thank you in advance!

import xarray as xr
import ultraplot as uplt
import cmaps

df = xr.open_dataset("./PRECIP_daily_CERRA_2021_August.nc")
precip = df["tp"]

fig, ax = uplt.subplot(projection="pcarree",lonlim=(26,45),latlim=(38,50),
                        reso="xx-hi",coast=True,grid=False,figsize=(12,9),
                        coastlinewidth=3,linewidth=3,lonlabels=False,latlabels=False,panelpad=0)
plot = xr.plot.pcolormesh(darray=precip[0,:,:],x="longitude",y="latitude",add_colorbar=False,levels=uplt.arange(10,210,10),cmap=cmaps.WhiteBlueGreenYellowRed,extend="max")
ax.colorbar(plot,loc="r",extend="max",ticklabelsize=16,labelsize=16,space=0.2)
ax.format(title="",titlesize=16)
fig.savefig(f"deneme.png",dpi=300)

Image

Image

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

Can you confirm that this issue also occurs with the basemap backend? I can’t tackle this problem until next week.