Commit 461ed277 by Jigyasa Watwani

added color bars

parent 803516c1
Showing with 24 additions and 5 deletions
...@@ -6,6 +6,7 @@ import argparse ...@@ -6,6 +6,7 @@ import argparse
import progressbar import progressbar
import os import os
import dolfin as df import dolfin as df
from mpl_toolkits.axes_grid1 import make_axes_locatable
def read_data(params, DIR): def read_data(params, DIR):
print('Reading data from %s/%s...' % (DIR, params['timestamp'])) print('Reading data from %s/%s...' % (DIR, params['timestamp']))
...@@ -63,13 +64,29 @@ def visualize(params, DIR, interactive=False): ...@@ -63,13 +64,29 @@ def visualize(params, DIR, interactive=False):
axu.set_xlim(np.min(x), np.max(x)) axu.set_xlim(np.min(x), np.max(x))
axu.set_ylim(np.min(times), np.max(times)) axu.set_ylim(np.min(times), np.max(times))
axu.set_ylabel(r'$t$') axu.set_ylabel(r'$t$')
umax, vmax, rhomax = np.max(u), np.max(v), np.max(rho)
axu.contourf(x, times, u, cmap='coolwarm') umin, vmin = -umax, -vmax
axv.contourf(x, times, v, cmap='coolwarm') rhomin = 0
axrho.contourf(x, times, rho, cmap='viridis') ucplot = axu.contourf(x, times, u, cmap='coolwarm', vmin = umin, vmax = umax)
vcplot = axv.contourf(x, times, v, cmap='coolwarm', vmin = vmin, vmax = vmax)
rhocplot = axrho.contourf(x, times, rho, cmap='viridis', vmin = rhomin, vmax = rhomax)
divideru = make_axes_locatable(axu)
ucax = divideru.append_axes("right", size="5%", pad=0.05)
dividerv = make_axes_locatable(axv)
vcax = dividerv.append_axes("right", size="5%", pad=0.05)
dividerrho = make_axes_locatable(axrho)
rhocax = dividerrho.append_axes("right", size="5%", pad=0.05)
plt.colorbar(ucplot, cax=ucax)
plt.colorbar(vcplot, cax=vcax)
plt.colorbar(rhocplot, cax=rhocax)
if params['morphogen']: if params['morphogen']:
axc.contourf(x, times, c, cmap='viridis') cmin, cmax = 0, 3*params['average_c']
ccplot = axc.contourf(x, times, c, cmap='viridis', vmin = cmin, vmax = cmax)
dividerc = make_axes_locatable(axc)
ccax = dividerc.append_axes("right", size="5%", pad=0.05)
plt.colorbar(ccplot, cax=ccax)
fig.savefig(os.path.join(DIR, '%s.png' % params['timestamp']), dpi=100) fig.savefig(os.path.join(DIR, '%s.png' % params['timestamp']), dpi=100)
...@@ -127,3 +144,5 @@ if __name__ == '__main__': ...@@ -127,3 +144,5 @@ if __name__ == '__main__':
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment