Skip to content

Commit

Permalink
Added function to make plots of LBB stability
Browse files Browse the repository at this point in the history
  • Loading branch information
danshapero committed Jun 29, 2023
1 parent 9e9f0c6 commit 0d118c4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions demo/lbb-stability/make_plots.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import json
import argparse
import numpy as np
import matplotlib.pyplot as plt

parser = argparse.ArgumentParser()
parser.add_argument("--input")
parser.add_argument("--output")
args = parser.parse_args()

with open(args.input, "r") as input_file:
data = json.load(input_file)

fig, ax = plt.subplots()
ax.set_title("Empirical inf-sup constants")
ax.set_xscale("log", base=2)
ax.set_ylim((0.0, 1.0))
ax.set_xlabel("Mesh spacing")
ax.set_ylabel("inf-sup constant")
for entry in data:
element = entry["element"]
hs, λs = zip(*entry["results"])
ax.scatter(hs, λs, label=element)
ax.legend()
fig.savefig(args.output, bbox_inches="tight")

0 comments on commit 0d118c4

Please sign in to comment.