我需要在 python 中绘制,图形为应力和应变
有了这个数据
S.No Stress Strain 0 0.000000 0.000000 1 -3343.068596 -0.520833 2 -3359.542402 -1.041667 3 -3363.690275 -1.562500 4 -3368.874071 -2.343750 5 -3375.428713 -3.515625 6 -3377.689516 -3.955078 7 -3380.871487 -4.614258 8 -3385.274720 -5.603027 9 -3386.895892 -5.973816 10 -3389.195531 -6.529999 11 -3392.487109 -7.364273 12 -3397.171464 -8.615685 13 -3398.871128 -9.084964 14 -3401.357499 -9.788883 15 -3404.965858 -10.844761 16 -3406.306571 -11.240716 17 -3408.273823 -11.834647 18 -3411.164927 -12.725545 19 -3412.242114 -13.059631 20 -3413.836265 -13.560761 21 -3416.195332 -14.312456 22 -3419.671825 -15.439998 23 -3420.967483 -15.862826 24 -3422.889965 -16.497069 25 -3425.741024 -17.448432 26 -3426.805424 -17.805193 27 -3428.391134 -18.340335 28 -3430.751166 -19.143049 29 -3434.254359 -20.347118 30 -3435.562196 -20.798644 31 -3437.512479 -21.475933 32 -3440.417226 -22.491867 33 -3441.502922 -22.872842 34 -3443.125125 -23.444305 35 -3445.546054 -24.301499 36 -3446.451645 -24.622947 37 -3447.806274 -25.105118 38 -3449.830488 -25.828376 39 -3452.850690 -26.913262 40 -3453.980182 -27.320094 41 -3455.669727 -27.930343 42 -3458.194084 -28.845716 43 -3459.138722 -29.188980 44 -3460.552807 -29.703877 45 -3462.667548 -30.476223 46 -3465.826112 -31.634742 47 -3466.981187 -32.059390 48 -3468.710177 -32.696362 49 -3470.435183 -33.333334
作为一个问题,我可以在 Abaqus 生成 txt 文件时绘制实时图表吗?
这是我正在使用的代码
import numpy as np
import matplotlib.pyplot as plt
with open("test-1-14M.txt") as f:
data = f.read()
data = data.split('\n')
x = [row.split(' ')[0] for row in data]
y = [row.split(' ')[0] for row in data]
fig = plt.figure()
ax1 = fig.add_subplot(70)
ax1.set_title("Plot title...")
ax1.set_xlabel('your x label..')
ax1.set_ylabel('your y label...')
ax1.plot(x, y, c='r', label='the data')
leg = ax1.legend()
plt.show()