0

I am trying to get the values intercept of two lines, t70_bot_inf and t70_top_0, and would like to mark it with a horizontal and vertical line. Are there any modules with could help me with this? I have tried Shapley which was unfortunately unsuccessful. Cheers!

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

#global values
sigma_ct_inf = 0
sigma_ct_0 = 0
sigma_c_inf = 30
sigma_c_0 = 12
beta = 0.8

#values T 70
A = 359000
Wb = 40830202.33
Wt = 72079066.94
Mmin = 701.17
Mmax = 978.52

#Magnel Diagram
e = np.arange(-200, 1001)

t70_top_0 = pd.Series({'y': ((e - (Wt / A)) / ((Mmin * 10 ** 6) + sigma_ct_0 * Wt)) * 10 ** 6})
t70_bot_0 = pd.Series({'y': ((e + (Wb / A)) / ((Mmin * 10 ** 6) + sigma_c_0 * Wb)) * 10 ** 6})
t70_top_inf = pd.Series({'y': (((e - (Wt / A)) * beta) / ((Mmax * 10 ** 6) - sigma_c_inf * Wt)) * 10 ** 6})
t70_bot_inf = pd.Series({'y': (((e + (Wb / A)) * beta) / ((Mmax * 10 ** 6) - sigma_ct_inf * Wb)) * 10 ** 6})

bot = np.min([t70_bot_0['y'], t70_bot_inf['y']], axis=0)
top = np.max([t70_top_0['y'], t70_top_inf['y']], axis=0)

fig, ax = plt.subplots()
ax.set_title('Magnel Diagram, T-70')
ax.plot(e, t70_top_0['y'], lw=0.5, label='Top, t = 0')
ax.plot(e, t70_bot_0['y'], lw=0.5, label='Bottom, t = 0')
ax.plot(e, t70_top_inf['y'], lw=0.5, label='Top, t = \u221E')
ax.plot(e, t70_bot_inf['y'], lw=0.5, label='Bottom, t = \u221E')

ax.fill_between(e, bot, top, where=top < bot, color='r', alpha=0.4)

ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
plt.ylabel('1/P0 [1/MN]')
plt.xlabel('Eccentricity [mm]')
ax.grid()
plt.legend()
plt.show()
ezrix
  • 27
  • 4
  • You could use find_root from [this post](https://stackoverflow.com/a/46911822/12046409) with `z = find_root(e, t70_bot_inf ['y'] - t70_top_0['y'])` and then use `z[0]` to draw a `ax.axvline(z[0])` and `np.interp(z, e, t70_top_0['y'])[0]` to draw a `ax.axhline(...)` – JohanC Feb 26 '20 at 23:35
  • @JohanC cheers! that worked:) – ezrix Feb 27 '20 at 15:28

0 Answers0