I am currently struggling to make a colorbar stick to the right yaxis of a contour plot whose x axis need to be align with an other line plot just below.
On the lower plot I would like to have two y axis on the left and right side but making a right y axis (switching yaxisposition to :right for ax4 ) creates a gap between the colorbar and the contour plot (which I would like to remove to save space !). And colgap!(fig.layout,0) doesn’t seem to do doing anything in that case.
If you have any ideas on the subject, I’d be grateful!
The layout takes the right axis y ticks into account when setting the gap to zero, so there really is no gap between the columns (accounting for the right y-ticklabels). I’m not sure how to make the layout algorithm ignore anything that isn’t a “box”, but you can hack it by setting a negative colgap:
Or you put the Colorbar not in a new layout column but into the right protrusion of cell 1, 1. You also need to give it alignmode = Outside() in that case or it won’t reserve space for its own right protrusion.