Burst Pressure of a thick-walled Sphere

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
HarryvL
Veteran
Posts: 1338
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: Burst Pressure of a thick-walled Sphere

Post by HarryvL »

Matplotlib. See source code.
User avatar
HarryvL
Veteran
Posts: 1338
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: Burst Pressure of a thick-walled Sphere

Post by HarryvL »

Sorry I was in a hurry.

Code: Select all

import matplotlib.pyplot as plt
from matplotlib.widgets import Button

cnt = plot(un, lbd)

def plot(un, lbd):
    class Index(object):
        def stop(self, event):
            self.cnt = False
            plt.close()
        def add(self, event):
            self.cnt = True
            plt.close()

    callback = Index()
    callback.cnt=False
    fig, ax = plt.subplots()
    plt.subplots_adjust(bottom=0.2)
    ax.plot(un, lbd, '-ok', color='black')
    ax.set(xlabel='displacement [mm]', ylabel='load factor [-]',
           title='')
    ax.grid()
    axstop = plt.axes([0.7, 0.05, 0.1, 0.075])
    axadd = plt.axes([0.81, 0.05, 0.1, 0.075])
    bstop = Button(axstop, 'stop')
    bstop.on_clicked(callback.stop)
    badd = Button(axadd, 'add')
    badd.on_clicked(callback.add)
    # fig.savefig("test.png")
    plt.show()

    return callback.cnt
cnt is used to complete the calculation or add 10 more steps.
Post Reply