[Matplotlib-devel] To stretch out a plot along the horizontal or vertical direction

Hello,

I’m struggling to stretch out a plot along the horizontal direction only. I have scaled it, that I know, but it gets displayed only in a white square window embedded in the whole canvas. Here is an attached snapshot. I’ve tried a number of things (figsize, layout constrained, rcParams and others) but they only enlarge the whole display window, not the plot within the window itself. In stackoverflow forum no one knows. My OS is Windows 10. I would appreciate if you could tell me what to do (in case you need, I attach my script)

Fernando

# 3D DELAUNAY TRIANGULATION OF AN UNSTRUCTURED-GRID DATAFILE

import numpy as np
import matplotlib.tri as mtri
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
with open('../gnuplot/bin/datos.txt', 'r') as f:
    lines = f.readlines()

    x, y, z = np.genfromtxt("../gnuplot/bin/datos.txt", unpack=True)

fig = plt.figure()
ax = fig.add_subplot(1,1,1)

ax.scatter(x, y, marker=".", c="#DC143C", edgecolors="black", s=100)
ax.set_xlabel('X')
ax.set_ylabel('Y')

triang = mtri.Triangulation(x, y)

fig = plt.figure()
ax = fig.add_subplot(1,1,1)

ax.triplot(triang, c="#D3D3D3", marker='.', markerfacecolor="#DC143C",
    markeredgecolor="black", markersize=5)

ax.set_xlabel('X')
ax.set_ylabel('Y')

isBad = np.where((x<-1) | (x>7) | (y<12) | (y>88), True, False)

mask = np.any(isBad[triang.triangles],axis=1)
triang.set_mask(mask)

fig = plt.figure()
ax = fig.add_subplot(1,1,1)

ax.triplot(triang, c="#D3D3D3", marker='.', markerfacecolor="#DC143C", 
    markeredgecolor="black", markersize=5)

ax.set_xlabel('X')
ax.set_ylabel('Y')

fig, ax = plt.subplots(subplot_kw={'projection':'3d'}, facecolor='lightgray')
fig.subplots_adjust(bottom=0, left=-0.15, top=1, right=0.56)
ax.get_proj = lambda: np.dot(Axes3D.get_proj(ax), np.diag([2.0, 2.0, 1.0, 1]))
#fig.patch.set_alpha(0.0) THIS JUST CHANGES THE COLOR OF THE BORDER TO WHITE

ax.plot_trisurf(triang, z, cmap='jet')
ax.scatter(x,y,z, marker='.', s=10, c="black", alpha=0.5)
ax.view_init(elev=30, azim=-45)

ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')

# plt.savefig('image.png', bbox_inches='tight', pad_inches=0) THIS DOESN'T WORK

plt.show()