def draw_target_cross(ax, time, freq, labeltext): time_line = (datatool.unix2time(time), datatool.unix2time(time)) ax.plot(time_line, ax.get_ylim(), 'r--', label=labeltext) freq_line = (freq, freq) ax.plot(ax.get_xlim(), freq_line, 'r--') ax.plot((datatool.unix2time(time)), (freq), 'ro')
lower_freq_limit = 49.94 upper_freq_limit = 50.025 ax.set_xlabel("Zeit [UTC]") ax.set_ylabel("Frequenz [Hz]") ylim = (lower_freq_limit, upper_freq_limit) ax.set_ylim(ylim) xlim = (np.min(grundremmingen.time), np.max(grundremmingen.time)) ax.set_xlim(xlim) ax.plot(grundremmingen.time, grundremmingen.freq, 'b-', label=r"Netzfrequenz") #ax.plot(grundremmingen.time, grundremmingen.freq_sg, 'b', label=r"Netzfrequenz") trumpet = datatool.calc_trumpet_curve(starttime, setfreq, startfreq, bottomfreq - startfreq, delta_Pa) ax.plot(trumpet.time, trumpet.trumpneg, 'r', label=r"Trompetenkurve") ax.plot(ax.get_xlim(), (setfreq, setfreq), 'b--', label=r"Sollwert $f_0 = 50Hz$") print "Beginn der Schnellabschaltung um %s bei %.3f Hz" % (datatool.unix2time(starttime), startfreq) gt.draw_target_cross(ax, starttime, startfreq, r"Schnellabschaltung $f_1=%.3f$" % startfreq) print "Tiefpunkt der Frequenz um %s bei %.3f Hz" % (datatool.unix2time(bottomtime), bottomfreq) gt.draw_target_cross(ax, bottomtime, bottomfreq, r"Tiefstand $f_2=%.3f$" % bottomfreq) ax.legend(loc="best", ncol=2, fontsize="small") ax.text(0.95, 0.01, r'$\Delta f_2=52 mHz$, $\Delta t = 19 s$', verticalalignment='bottom', horizontalalignment='right', transform=ax.transAxes) #ax.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3, # ncol=2, mode="expand", borderaxespad=0.) #hfmt = dates.DateFormatter('%H:%M') #ax.xaxis.set_major_formatter(hfmt) y_formatter = mpl.ticker.ScalarFormatter(useOffset=False)