Z-Axis label cut off in matplotlib

18 Views Asked by At

enter image description here

I've been trying to reformat the graph produced from this code so the Z-axis label is visible but nothing so far has worked. Does anyone have any insight? Thanks!

import numpy as np
import pandas as pd
from scipy import optimize
from matplotlib import pyplot as plt

df = pd.read_csv('flowDS_dat.csv')

X = [list(df.Diameter), list(df.Slope)]
Y = list(df.Flow)
def func(X, a0, a1, a2):
    return a0*(X[0]**a1)*(X[1]**a2)


popt, pcov = optimize.curve_fit(func, X, Y)

print('a0 = {}'.format('{:1.3f}'.format(popt[0])))
print('a1 = {}'.format('{:1.3f}'.format(popt[1])))
print('a2 = {}\n'.format('{:1.3f}'.format(popt[2])))
print(f'Final Equation: Q = {"{:1.3f}".format(popt[0])} * D^{"{:1.3f}".format(popt[1])} * S^{"{:1.3f}".format(popt[2])}\n')

x_vals = [2.5, 0.025]
Q = func(x_vals, popt[0], popt[1], popt[2])
print('Flow through the pipe with the given parameters is {} ft^3/s\n'.format('{:1.3f}'.format(Q)))


ax = plt.figure().add_subplot(projection = '3d')
ax.plot(X[0], X[1], Y)
plt.title('Flow vs. Slope vs. Diameter')
ax.set_xlabel('Diameter (ft)')
ax.set_ylabel('Slope (ft/ft)')
ax.set_zlabel('Flow (ft^3/s)')

I've used tight_fit, and I've played around with the sizing. Please, any help is greatly appreciated

0

There are 0 best solutions below