Skip to content
Snippets Groups Projects
Commit 6975fe38 authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

Merge branch 'fix/ldc-example-python' into 'master'

[liddrivencavity] Fix test if matplotlib is not ready

Closes #960

See merge request !2352

(cherry picked from commit 79be4b10)

d5de54d3 [liddrivencavity] Fix test if matplotlib is not ready
parent e9a5a5f9
No related branches found
No related tags found
3 merge requests!2449WIP: python script to extract modules,!2366remove spurious semicolon in cornerpoint parameter file,!2354Merge branch 'fix/ldc-example-python' into 'master'
......@@ -47,39 +47,44 @@ jurjevicexpx = jurjevicexpx/2.0 + 0.5
####################################################
#### plotting ######################################
####################################################
import matplotlib.pyplot as plt
try:
import matplotlib
import matplotlib.pyplot as plt
fig, (ax1, ax2, ax3, ax4) = plt.subplots(1, 4, figsize = (9,4))
ax1.plot(vx['1'], y['1'] , color='black', label=u"DuMu$^\mathrm{x}$",linewidth=2)
ax1.plot(jurjevicnumvx, jurjevicnumy, '--', markerfacecolor='white', color='black', label=u"R.Jurjevic et al., num")
ax1.plot(jurjevicexpvx, jurjevicexpy, 'o', markerfacecolor='white', color='black', label=u"R.Jurjevic et al., exp")
ax1.set_xlabel(r"$v_x$[m/s]")
ax1.set_ylabel(u"y [m]")
fig, (ax1, ax2, ax3, ax4) = plt.subplots(1, 4, figsize = (9,4))
ax1.plot(vx['1'], y['1'] , color='black', label=u"DuMu$^\mathrm{x}$",linewidth=2)
ax1.plot(jurjevicnumvx, jurjevicnumy, '--', markerfacecolor='white', color='black', label=u"R.Jurjevic et al., num")
ax1.plot(jurjevicexpvx, jurjevicexpy, 'o', markerfacecolor='white', color='black', label=u"R.Jurjevic et al., exp")
ax1.set_xlabel(r"$v_x$[m/s]")
ax1.set_ylabel(u"y [m]")
ax2.plot(x['1'], vy['1'], color='black', label=u"DuMu$^\mathrm{x}$",linewidth=2)
ax2.plot(jurjevicnumx, jurjevicnumvy, '--', markerfacecolor='white', color='black', label=u"R.Jurjevic, num")
ax2.plot(jurjevicexpx, jurjevicexpvy, 'o', markerfacecolor='white', color='black', label=u"R.Jurjevic, exp")
ax2.set_xlabel(u"x [m]")
ax2.set_ylabel(r"$v_y$[m/s]",labelpad=1)
ax2.set_xlabel(u"x [m]")
ax2.set_ylabel(r"$v_y$[m/s]",labelpad=1)
ax2.plot(x['1'], vy['1'], color='black', label=u"DuMu$^\mathrm{x}$",linewidth=2)
ax2.plot(jurjevicnumx, jurjevicnumvy, '--', markerfacecolor='white', color='black', label=u"R.Jurjevic, num")
ax2.plot(jurjevicexpx, jurjevicexpvy, 'o', markerfacecolor='white', color='black', label=u"R.Jurjevic, exp")
ax2.set_xlabel(u"x [m]")
ax2.set_ylabel(r"$v_y$[m/s]",labelpad=1)
ax2.set_xlabel(u"x [m]")
ax2.set_ylabel(r"$v_y$[m/s]",labelpad=1)
handles, labels = ax2.get_legend_handles_labels()
fig.legend(handles, labels, bbox_to_anchor=(0.51, 1.0), ncol=3, labelspacing=0.)
handles, labels = ax2.get_legend_handles_labels()
fig.legend(handles, labels, bbox_to_anchor=(0.51, 1.0), ncol=3, labelspacing=0.)
ax3.plot(vx['1000'], y['1000'], color='black', label=u"DuMu$^\mathrm{x}$",linewidth=2)
ax3.plot(ghiavx, ghiay, 'o', markerfacecolor='white', color='black', label=u"Ghia et al.")
ax3.set_xlabel(r"$v_x$[m/s]")
ax3.set_ylabel(u"y [m]")
ax3.plot(vx['1000'], y['1000'], color='black', label=u"DuMu$^\mathrm{x}$",linewidth=2)
ax3.plot(ghiavx, ghiay, 'o', markerfacecolor='white', color='black', label=u"Ghia et al.")
ax3.set_xlabel(r"$v_x$[m/s]")
ax3.set_ylabel(u"y [m]")
ax4.plot(x['1000'], vy['1000'], color='black', label=u"DuMu$^\mathrm{x}$",linewidth=2)
ax4.plot(ghiax, ghiavy, 'o', markerfacecolor='white', color='black', label=u"Ghia et al.")
ax4.set_xlabel(u"x [m]")
ax4.set_ylabel(r"$v_y$[m/s]",labelpad=1)
ax4.plot(x['1000'], vy['1000'], color='black', label=u"DuMu$^\mathrm{x}$",linewidth=2)
ax4.plot(ghiax, ghiavy, 'o', markerfacecolor='white', color='black', label=u"Ghia et al.")
ax4.set_xlabel(u"x [m]")
ax4.set_ylabel(r"$v_y$[m/s]",labelpad=1)
handles, labels = ax4.get_legend_handles_labels()
fig.legend(handles, labels, bbox_to_anchor=(0.92, 1.0), ncol =2, labelspacing=0.)
fig.tight_layout(rect=[0.03, 0.07, 1, 0.9], pad=0.4, w_pad=2.0, h_pad=1.0)
handles, labels = ax4.get_legend_handles_labels()
fig.legend(handles, labels, bbox_to_anchor=(0.92, 1.0), ncol =2, labelspacing=0.)
fig.tight_layout(rect=[0.03, 0.07, 1, 0.9], pad=0.4, w_pad=2.0, h_pad=1.0)
plt.savefig("lidverification.png", dpi= 300)
if not args['noplotwindow']: plt.show()
plt.savefig("lidverification.png", dpi= 300)
if not args['noplotwindow']: plt.show()
except ImportError:
print("Skipping plot: matplotlib has not been found.")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment