Skip to content

Instantly share code, notes, and snippets.

View krystophny's full-sized avatar

Christopher Albert krystophny

View GitHub Profile
@krystophny
krystophny / parallel_plot.py
Created May 14, 2019 06:58
Exporting plots in parallel using concurrent.futures
import concurrent.futures
import matplotlib.pyplot as plt
import numpy as np
import time, random
def do_stuff(a): # these are examples.
x = np.linspace(1,10)
plt.plot(x, np.cos(a*x))
plt.savefig('{}.png'.format(a))
time.sleep(random.random())
@krystophny
krystophny / triplot_sample.py
Created May 7, 2019 11:13
Plotting on a mesh
import matplotlib.pyplot as plt
import matplotlib.tri as mpltri
import meshio # von https://github.com/nschloe/meshio
mesh = meshio.read('any_known_mesh_format.msh')
tria = mpltri.Triangulation(mesh.points[:,0], mesh.points[:,1], mesh.cells['triangle'])
for k in range(nplots):
plt.figure()
plt.tricontourf(tria, plot_data[k])