Page 1 of 1

### Space between each subplot of a triplot

Posted: July 09 2020
Hello,

I produce triplots like this : I would like to get spaces between each subplot like in this example : I tried to play with some settings options to use in the same way for example to specify fontsize of axes, i.e :

Code: Select all

g = plots.get_subplot_plotter()
g.settings.axes_fontsize = 20

But I couldn't find the option to apply to specify these spaces between subplot

### Re: Space between each subplot of a triplot

Posted: July 16 2020
A strange case occurs concerning the equal space between all subplots. While I was doing different tests to get this space between subplots, I found
a case where if I apply a big y-axis labelpad on the parameter "w_a", I get these equal spaces and for the moment, I can't explain how this result is obtained.

For example, If I do :

Code: Select all

# Browse each subplot of triangle
for m in range(0,7):
for n in range(0,m+1):
ax = g.subplots[m,n]

# If I am not on diagonal posterior into triplot
if (m != n):
if (m == 3 and n == 0):
# Apply a big shift of "w_a" to the left : 50 !!!
ax.yaxis.set_label_coords(x0-50, y0)

Then I firstly the image : where label appears totally on the left side and the triplot on the right (even too small to be visible from entire figure).

But if I zoom on the right located triplot, I get interesting results : You can notice that I get this way the wanted behavior, i.e equal space between each subplot.

But I can't explain this result which doesn't correspond to the previous image in the thread of discussion. The ideal would be to have the same behavior (same equal space) but with right aligned labels (I mean without having to apply too large shift on them).

If this strange behavior could be explained by someone, this would be fine to tell it,

Regards

### Re: Space between each subplot of a triplot

Posted: July 22 2020
Hello,

The strange behavior that I mentionned previously might be related to the size of the figure. I say this since when the labels are far away from each other, all the subplots are equally spaced distant like in the figure I showed above (by the way, I don't know how this space between each subplot is computed).

Any help is welcome to overcome this issue.

### Re: Space between each subplot of a triplot

Posted: July 23 2020
From my last tests, the space between each subplot is not related to the size of figure :

I have set :

Code: Select all

plt.rcParams["figure.figsize"] = (100,100)

Code: Select all

plt.rcParams["figure.figsize"] = (30,30)
and this doesn't change anything, I mean about the wanted equi-distance between each subplot and the shifting of label on both axis.

### Re: Space between each subplot of a triplot

Posted: August 06 2020
I update my progress about the equi-space that I would like to get since I don't want that posts overlap themselves.

For instant, I don't know which parameter I have to modify or to assign that controls the space between each subplot.

I tried to manually set a space character :

Code: Select all

Code: Select all

      spacex = '  '
spacey = '  '

But unfortulately, this doesn't seem to have an effect on each box. would you have another trick ?

### Re: Space between each subplot of a triplot

Posted: August 06 2020
Getdist is designed to have zero space between the triangle subplots. Anything else you'd have to manage yourself. (you seem to be wasting a lot of time on trivial - and hence probably unnecessary - plotting tweaks!?)

### Re: Space between each subplot of a triplot

Posted: August 07 2020
Dear Antony,

I have finally got the triplot with all parameters that I wanted to align. The result is shown below : Now, to finish with all this stuff, I want to put manually the location of legend since as you can see on the figure, there is an overlap with the figure.
Ideally, I would like to set the legend totally on the right and if possible not completely on the top.

If it can be done, how to perform this manual location of the legend ?

Thks

### Re: Space between each subplot of a triplot

Posted: August 07 2020

### Re: Space between each subplot of a triplot

Posted: August 07 2020
This is the first thing I tried. The above figure has been produced with :

Code: Select all

g.triangle_plot([matrix1, matrix2],
names,
filled = True,
legend_labels = [label1, label2],
legend_loc = 'upper right',
contour_colors = ['red', 'darkblue'],
line_args = [{'lw':2, 'color':'red'},
{'lw':2, 'color':'darkblue'}]
)
But as you can see, there is an overlapping : that's why I talked about to set "manually" (with coordinates) the legend.

Is there a workaround ? Regards

### Re: Space between each subplot of a triplot

Posted: August 10 2020
For those who are interested in setting a space between each subplot, here below what I have included into the script :

Code: Select all

# Settings
g.settings.constrained_layout = True

# # Set space between each subplot
g.fig.subplots_adjust(left = 0.1, right = 0.98, top = 0.95, bottom = 0.1, hspace = 0.2, wspace = 0.2)
You can put your own values as a function of the triplot size and number of subplots.

Hoping this will help.