## Monday, April 16, 2012

### Contour plotting (2D) - Sage - Streamlines

So, I am getting more familiar with other scientific software to use for my research.  One I've been trying is Sage, and I've made a few post about it.  I like it so far.  Here is an example of a contour plot I've done recently for some streamlines and some effects.

http://www.sagemath.org/doc/reference/sage/plot/contour_plot.html

kap_pa = 0.00621
r,z = var('r,z')
psee1 = kap_pa*z*sin(pi*r^2)
contour_plot(psee1, (r, 0, 1), (z, 0, 1), contours = 20, fill=False, axes_labels=['r','z'], aspect_ratio=1)


kap_pa = 0.00621
r,z = var('r,z')
psee1 = kap_pa*z*sin(pi*r^2)
contour_plot(psee1, (r, 0, 1), (z, 0, 2), contours = 20, fill=False, axes_labels=['r','z'], aspect_ratio=2)


kap_pa = 0.00621
r,z = var('r,z')
psee1 = kap_pa*z*sin(pi*r^2)
contour_plot(psee1, (r, 0, 1), (z, 0, 1), contours = 20, fill=True, axes_labels=['r','z'])


kap_pa = 0.00621
r,z = var('r,z')
psee1 = kap_pa*z*sin(pi*r^2)
contour_plot(psee1, (r, 0, 1), (z, 0, 2), contours = 20, fill=True, axes_labels=['r','z'], aspect_ratio=2)


kap_pa = 0.00311
r,z = var('r,z')
psee1 = kap_pa*z*sin(pi*r^2)
contour_plot(psee1, (r, 0, 1), (z, 0, 2), contours = 20, fill=True, axes_labels=['r','z'], aspect_ratio=2)


kap_pa = 0.00311
r,z = var('r,z')
psee1 = kap_pa*z*sin(pi*r^2)
contour_plot(psee1, (r, 0, 1), (z, 0, 1), contours = 20, fill=False, linestyles='dashdot', axes_labels=['r','z'])


kap_pa = 0.00621
r,z = var('r,z')
psee1 = kap_pa*z*sin(pi*r^2)
contour_plot(psee1, (r, 0, 1), (z, 0, 1), contours = 20, fill=False, linewidths=[1,5], linestyles=['solid','dashed'], axes_labels=['r','z'])


kap_pa = 0.00621
r,z = var('r,z')
psee1 = kap_pa*z*sin(pi*r^2)
contour_plot(psee1, (r, 0, 1), (z, 0, 1), contours = 20, cmap='hsv', axes_labels=['r','z'])


kap_pa = 0.00621
r,z = var('r,z')
psee1 = kap_pa*z*sin(pi*r^2)
contour_plot(psee1, (r, 0, 1), (z, 0, 1), contours = 20, cmap=[(1,0,0), (0,1,0), (0,0,1)], axes_labels=['r','z'])


kap_pa = 0.00621
r,z = var('r,z')
psee1 = kap_pa*z*sin(pi*r^2)
contour_plot(psee1, (r, 0, 1), (z, 0, 1), contours = 20, cmap='hsv', labels=True, axes_labels=['r','z'])


kap_pa = 0.00621
r,z = var('r,z')
psee1 = kap_pa*z*sin(pi*r^2)
contour_plot(psee1, (r, 0, 1), (z, 0, 1), contours = 20, cmap='hsv', labels=True, label_fmt="%1.4f", label_colors='black', axes_labels=['r','z'])


kap_pa = 0.00621
r,z = var('r,z')
psee1 = kap_pa*z*sin(pi*r^2)
contour_plot(psee1, (r, 0, 1), (z, 0, 1), contours = 20, cmap='hsv', labels=True, label_fmt="%1.4f", label_colors='black', label_fontsize=14, axes_labels=['r','z'])

kap_pa = 0.00621
r,z = var('r,z')
psee1 = kap_pa*z*sin(pi*r^2)
contour_plot(psee1, (r, 0, 1), (z, 0, 1), contours = 20, cmap='hsv', colorbar=True, labels=True, label_fmt="%1.4f", label_colors='black', label_fontsize=10, axes_labels=['r','z'])