ax1, ax2, ax3 = fig.subplots(3,
                             1,
                             sharex=True,
                             sharey=True,
                             gridspec_kw={
                                 'left': 0.35,
                                 'bottom': 0.3,
                                 'top': 0.9,
                                 'hspace': 0.05
                             })

lines = {}
lines['A'], = ax1.plot([], [], lw=2, color='blue')
lines['B'], = ax2.plot([], [], lw=2, color='red')
lines['somme'], = ax3.plot([], [], lw=2, color='black')

x = np.linspace(-1., 1., 1001) * 1E-6

ax1.set_ylim(-2.1, 2.1)
ax3.set_xlabel('Position (nm)')
ax3.set_xlim(x.min() * 1E9, x.max() * 1E9)

param_widgets = make_param_widgets(parameters,
                                   plot_data,
                                   slider_box=[0.35, 0.07, 0.4, 0.15])
reset_button = make_reset_button(param_widgets)

if __name__ == '__main__':
    plt.show()
示例#2
0
# On trace la courbe spinodale
ax.plot(v_spin, p_spin, 'k--', lw=2, label='Courbe spinodale')

# On trace la courbe de saturation
ax.plot(v_sat, p_sat, 'b--', lw=2, label="Courbe de saturation")

# Affichage du point critique
ax.plot(1.0,1.0,'go')

lines = {}
lines["Courbe spinodale"], = ax.plot([], [], lw=4, color='red', label="Isotherme")
lines["spin"], = ax.plot([], [], 'ko')
lines["sat"], = ax.plot([], [], 'bo',ls='-',lw=4)

ax.set_xlim(0.4, 3.0)
ax.set_ylim(0, 2.5)
ax.set_xlabel(r"Volume reduit $V_r$")
ax.set_ylabel(r"Pression reduite $P_r$")
ax.legend()


param_widgets = make_param_widgets(parameters, plot_data, slider_box=[0.25, 0.03, 0.4, 0.05])
reset_button = make_reset_button(param_widgets)

if __name__=='__main__':
    plt.show()



fig = plt.figure()
fig.suptitle(titre)
fig.text(0.5, .93, "Fréquence du signal :{} Hz".format(frequence_signal), 
            multialignment='left', verticalalignment='top', horizontalalignment='center')

ax = fig.add_axes([0.15, 0.2, 0.7, 0.7])

lines = {}
lines['Analogique'], = ax.plot(table_vrai_signal_x, table_vrai_signal_y , color='blue', linewidth=1, label="Analogique")
lines['Numérique'],  = ax.plot([],[], color='red', marker='o', markersize=10, linewidth=2, label="Numérique")


ax.legend(loc="upper left", bbox_to_anchor=[0, 1], ncol=2, shadow=True, fancybox=True)

ax.set_ylim(-1.3, 1.4)
ax.set_ylabel(r'U.A')
ax.set_xlabel(r't(s)')


param_widgets = make_param_widgets(parameters, plot_data, slider_box=[0.4, 0.02, 0.3, 0.04])
choose_widget = make_choose_plot(lines, box=[0.005, 0.025, 0.2, 0.10], which=['Analogique'])
reset_button = make_reset_button(param_widgets, box=[0.8, 0.02, 0.1, 0.04])


if __name__=='__main__':
    plt.show()



示例#4
0
#===========================================================
# --- Création de la figure et mise en page ----------------
#===========================================================

fig = plt.figure()
fig.suptitle(titre)
fig.text(0.02,
         .9,
         justify(description),
         multialignment='left',
         verticalalignment='top')

ax = fig.add_axes([0.35, 0.25, 0.6, 0.65], aspect='equal')

lines = {}
lines['Masse réduite'], = ax.plot([], [], 'k-', lw=2, visible=False)
lines['M1'], = ax.plot([], [], 'r-', lw=2)
lines['M2'], = ax.plot([], [], 'b-', lw=2)

ax.set_xlim(-3, 3)
ax.set_ylim(-3, 3)

param_widgets = make_param_widgets(parameters,
                                   plot_data,
                                   slider_box=[0.45, 0.07, 0.5, 0.07])
reset_button = make_reset_button(param_widgets)
choose_widget = make_choose_plot(lines, box=[0.015, 0.10, 0.2, 0.15])

if __name__ == '__main__':
    plt.show()
ax.set_ylabel(r'$\psi$')


ax.axhline(y=1,xmin=Xmin,xmax=Xmax,linestyle=':',color='grey') 
ax.axhline(y=-1,xmin=Xmin,xmax=Xmax,linestyle=':',color='grey') 

lines = {}
lines['courbe'], = ax.plot([],[],'c-')
lines['enveloppes_p'], = ax.plot([], [], 'r--')
lines['enveloppes_m'], = ax.plot([], [], 'r--')

lines['points_vg'], = ax.plot([], [], 'ro')  # point rouge avançant à vg
lines['points_vphi'], = ax.plot([], [], 'bo') # point bleu avançant à vphi


param_widgets = make_param_widgets(parameters, plot_data, slider_box=[0.08+0.84*2/12, 0.01, 0.84*10/12, 0.05])

#===========================================================
# --- Animation --------------------------------------------
#===========================================================

start_animation = False # Est-ce que l'animation se lance automatiquement ? 

def animation_function(val):
    param_widgets['t'].set_val((val/10)%10)
    # Astuce permettant de stopper l'animation tout de suite
    if val==0 and start_animation==False:
        ani.event_source.stop()
    return lines.values()

ani = animation.FuncAnimation(fig, animation_function, interval=100.0)