Placement of colorbar with subplots

Hi there,
first of all, I really want to say how much I appreciate the new modern mode :slight_smile:

Now I have two questions, both relating colorbars together with subplots:

  1. If I have a plot with two subplots side by side, and I want to place the common colorbar centred below the two plots, I already found out that I can do this nicely by putting it AFTER the subplot end. The justification for the placement relates to the overall canvas. However, then my labels of the colorbar are cut of at the bottom. How can I prevent this? Inside the subplot environment, I can make room with the -C clearance argument; else, I run into the same problem here.
  2. Sometimes, one wishes to place the colorbar not related to the overall canvas but relative to only some of the subplots (e.g. two with a shared colorbar, one with its one). Is there a way to do this automatically? Or else, how do I get the distance between two maps in subplots without the map labels? With the -M argument, I know the distance between the subplots, but I don’t know how much space the labels take up.

Any help on these two questions is much appreciated!
Best, Eva

1 Like

Are you using GMT 6.4? I think we had a recent problem in 6.3 that got fixed that related to the truncation at bottom. You can tell by adding a -Y20c to the very first plot command you have (or the subplot command if that is before the first plotting. That should be a workaround.

If I understand your second issue it may be something like this: You have a 3x2 layout and the fist row should have a shared colorbar but the rest not. If so I think you need to break this down in to two subplots: One with 1x2 and another below with 2x2.

Thank you very much for your quick reply! I am still using 6.0 (still the Ubuntu default GMT version), but will now update to 6.4
I am sorry, but I still have a question about the second point. Having two subplot environments side by side is indeed a good idea! But how do I get the total width of the first, to place the second such, that the distance between the plots is always the same? I.e. one does not see, that it’s two subplot environments?
Thank you very much! :slight_smile:

After a subplot end you can use the special values h and w in -X -Y (i.e., the width and height of the previous subplot). So to start the 2nd subplot to the right of the first you would use -Xw+12p for instance. Once you are on 6.4 you can try a dummy setup of what you want with just basemap commands and post and issue on GitHub if the alignment doesn’t work as I expect.

Just a note for anyone else reading this who is using GMT 6.4.0 and still having issue 1 (colorbar being clipped off the bottom): for me, the problem was there using version GMT 6.4.0 but it went away upon upgrading to GMT 6.5.0.