def draw_interface_add_legend(current_data): from pylab import plot from numpy import abs, where, log10, exp, sin, linspace #plot([0., 0.], [-1000., 1000.], 'k--') try: from clawpack.visclaw import legend_tools labels = [ 'Level 1', 'Level 2', 'Level 3', 'Level 4', 'Level 5', 'Level 6', 'Level 7', 'Level 8', 'Level 9', 'Level 10' ] legend_tools.add_legend(labels, colors=amr_color, markers=amr_marker, linestyles=amr_linestyle, loc='upper left') except: pass # exact solution: t = current_data.t xx = linspace(-12, 12, 10000) #xpct = xx + t #xmct = xx - t #p_true = ar*exp(-betar*(xpct-5)**2) * sin(freqr*xpct) + \ # al*exp(-betal*(xmct+5)**2) * sin(freql*xmct) p_true = p_true_fcn(xx, t) plot(xx, p_true, 'k')
def add_particles(current_data): t = current_data.t # plot recent path: t_path_length = 10. # length of path trailing particle kwargs_plot_path = {'linewidth': 1, 'color': 'k'} particle_tools.plot_paths(gauge_solutions, t1=t - t_path_length, t2=t, gaugenos=gaugenos_lagrangian, kwargs_plot=kwargs_plot_path) # plot current location: kwargs_plot_point = {'marker': 'o', 'markersize': 3, 'color': 'k'} particle_tools.plot_particles(gauge_solutions, t, gaugenos=gaugenos_lagrangian, kwargs_plot=kwargs_plot_point) # plot any stationary gauges: gaugetools.plot_gauge_locations(current_data.plotdata, \ gaugenos=gaugenos_stationary, format_string='kx', add_labels=False) kwargs = {'loc': 'upper left'} legend_tools.add_legend(['Lagrangian particle', 'Stationary gauge'], linestyles=['', ''], markers=['o', 'x'], loc='lower right', framealpha=0.5, fontsize=10)
def add_legend(current_data): try: from clawpack.visclaw import legend_tools labels = ['Level 1','Level 2', 'Level 3'] legend_tools.add_legend(labels, colors=['g','b','r'], markers=['^','s','o'], linestyles=['','',''], loc='upper left') except: pass
def add_legend(current_data): try: from clawpack.visclaw import legend_tools legend_tools.add_legend(labels=level_labels, colors=level_colors, markers=level_markers, linestyles=level_styles, loc='upper right') except: print('legend_tools error') pass
def draw_interface_add_legend(current_data): from pylab import plot plot([0., 0.], [-1000., 1000.], 'k--') try: from clawpack.visclaw import legend_tools labels = ['Level 1','Level 2', 'Level 3'] legend_tools.add_legend(labels, colors=['g','b','r'], markers=['^','s','o'], linestyles=['','',''], loc='upper left') except: pass
def add_legend(current_data): try: from clawpack.visclaw import legend_tools labels = ['Level 1', 'Level 2', 'Level 3'] legend_tools.add_legend(labels, colors=['g', 'b', 'r'], markers=['^', 's', 'o'], linestyles=['', '', ''], loc='upper left') except: pass
def plot_qtrue_with_legend(current_data): from pylab import plot, legend x = linspace(0,1,1000) t = current_data.t q = qtrue(x,t) plot(x,q,'k',label='true solution') try: from clawpack.visclaw import legend_tools labels = ['Level 1','Level 2', 'Level 3','True solution'] legend_tools.add_legend(labels, colors=['g','b','r','k'], markers=['^','s','o',''], linestyles=['','','','-'], loc='lower right') except: legend(loc='lower right')
def plot_qtrue_with_legend(current_data): from pylab import plot, legend x = linspace(0, 1, 1000) t = current_data.t q = qtrue(x, t) plot(x, q, 'k', label='true solution') try: from clawpack.visclaw import legend_tools labels = ['Level 1', 'Level 2', 'Level 3', 'True solution'] legend_tools.add_legend(labels, colors=['g', 'b', 'r', 'k'], markers=['^', 's', 'o', ''], linestyles=['', '', '', '-'], loc='lower right') except: legend(loc='lower right')