def func_plotxy(self, event): def get_axis_data(self, axis=1): axis_int = axis axis = 'y%d' % axis y = self.data[prop[axis].pop('var')] x = self.data[prop['x']['var']] idx = self.get_yidx(axis=axis_int)* \ (x >= prop['x'] ['min']) * \ (x <= prop['x'] ['max']) * \ (y >= prop[axis]['min']) * \ (y <= prop[axis]['max']) x = np.array(x[idx]) y = np.array(y[idx]) return x, y, prop prop = self.get_plot_properties() if not prop: return None x1, y1, prop = get_axis_data(self, axis=1) x_lims = prop['x']['min'], prop['x']['max'] y1_lims = prop['y1'].pop('min'), prop['y1'].pop('max') plt.figure() if prop['x']['var'] == 'wg_datenum': plt.plot_date(x1, y1, **prop['y1']) plt.xticks(rotation=45, ha='right') plt.subplots_adjust(bottom=0.2) else: plt.plot(x1, y1, **prop['y1']) plt.xlim(x_lims) plt.ylim(y1_lims) plt.ylabel(prop['y1']['label'], color=prop['y1']['color'], size=14) plt.yticks(color=prop['y1']['color']) if prop.has_key('y2'): x2, y2, prop = get_axis_data(self, axis=2) x_lims = prop['x'].pop('min'), prop['x'].pop('max') y2_lims = prop['y2'].pop('min'), prop['y2'].pop('max') plt.twinx() if prop['x']['var'] == 'wg_datenum': plt.plot_date(x2, y2, **prop['y2']) else: plt.plot(x2, y2, **prop['y2']) plt.xlim(x_lims) plt.ylim(y2_lims) plt.ylabel(prop['y2']['label'], color=prop['y2']['color'], size=14) plt.yticks(color=prop['y2']['color']) plt.title(self.xy_title.GetValue()) plt.show()
def add_time_marker(ax, times): for time_plot in times: plt.plot_date(dates.date2num(time_plot['time']), 0, marker=align_marker(time_plot['marker'], valign='bottom'), ms=12, clip_on=False, markerfacecolor=time_plot['color'], markeredgecolor=time_plot['color'], markeredgewidth=0.)
def version2(times): # see http://mail.python.org/pipermail/python-list/2003-November/236559.html # http://www.gossamer-threads.com/lists/python/python/665014 from matplotlib.pylab import plot, show, title, xlabel, ylabel, gca, bar, savefig, plot_date dates_and_counts = get_dates_and_counts(times) dates, counts = zip(*dates_and_counts) # bar(dates,counts) plot_date(dates,counts) xlabel("Date") ylabel("count") show()
def draw_graph(dates, counts): ########################################################### # Drawing takes place here. pylab.figure(1) ax = pylab.subplot(111) pylab.plot_date(dates, counts, color='r', linestyle='-', marker='o', markersize=3) ax.xaxis.set_major_formatter(pylab.DateFormatter('%Y')) ax.xaxis.set_major_locator(pylab.YearLocator()) ax.xaxis.set_minor_locator(pylab.MonthLocator()) ax.set_xlim((dates[0] - 92, dates[len(dates) - 1] + 92)) ax.yaxis.set_major_formatter(pylab.FormatStrFormatter('%d')) pylab.ylabel('Total # of Public DAV Servers') lastdate = datetime.datetime.fromordinal(dates[len(dates) - 1]).strftime("%B %Y") pylab.xlabel("Data as of " + lastdate) pylab.title('Security Space Survey of\nPublic Subversion DAV Servers') # End drawing ########################################################### png = open(OUTPUT_FILE, 'w') pylab.savefig(png) png.close() os.rename(OUTPUT_FILE, OUTPUT_FILE + ".tmp.png") try: im = Image.open(OUTPUT_FILE + ".tmp.png", 'r') (width, height) = im.size print("Original size: %d x %d pixels" % (width, height)) scale = float(OUTPUT_IMAGE_WIDTH) / float(width) width = OUTPUT_IMAGE_WIDTH height = int(float(height) * scale) print("Final size: %d x %d pixels" % (width, height)) im = im.resize((width, height), Image.ANTIALIAS) im.save(OUTPUT_FILE, im.format) os.unlink(OUTPUT_FILE + ".tmp.png") except Exception as e: sys.stderr.write("Error attempting to resize the graphic: %s\n" % (str(e))) os.rename(OUTPUT_FILE + ".tmp.png", OUTPUT_FILE) raise pylab.close()
def drawAbsRBacktest(self,portReturn,portReturn1,dailyDate,path,name): pylab.clf() pylab.plot_date(pylab.date2num(dailyDate),portReturn,'r',linewidth=0.8,linestyle='-') pylab.plot_date(pylab.date2num(dailyDate),portReturn1,'b',linewidth=0.8,linestyle='-') xtext = pylab.xlabel('Out-Of-Sample Date') ytext = pylab.ylabel('Cumulative Return') ttext = pylab.title('Portfolio Return Vs Benchmark Return') pylab.grid(True) pylab.setp(ttext, size='large', color='r') pylab.setp(xtext, size='large', weight='bold', color='g') pylab.setp(ytext, size='large', weight='light', color='b') yearFormat=matDate.DateFormatter('%Y%m%d') ax=pylab.gca() ax.xaxis.set_major_formatter(yearFormat) pylab.savefig('%s%sAbsRbacktest.png'%(path,name))
def plot_history(history, series={}): """ Plot the evolution of total coins according to time. """ history = np.array(history) series['total'] = np.unique([t['address'] for t in history]) def get_serie(addresses, history): hist = [t for t in history if t['address'] in addresses] times = [datetime.datetime.fromtimestamp(t['time']) for t in hist] coins = np.cumsum([t['value'] for t in hist]) return {'times': times, 'coins': coins} ax = plt.subplot(111) for s in series: serie = get_serie(series[s], history) plt.plot_date(serie['times'], serie['coins'], '-', linewidth=2) plt.legend([s for s in series]) return ax
def draw_graph(dates, counts): ########################################################### # Drawing takes place here. pylab.figure(1) ax = pylab.subplot(111) pylab.plot_date(dates, counts, color='r', linestyle='-', marker='o', markersize=3) ax.xaxis.set_major_formatter( pylab.DateFormatter('%Y') ) ax.xaxis.set_major_locator( pylab.YearLocator() ) ax.xaxis.set_minor_locator( pylab.MonthLocator() ) ax.set_xlim( (dates[0] - 92, dates[len(dates) - 1] + 92) ) ax.yaxis.set_major_formatter( pylab.FormatStrFormatter('%d') ) pylab.ylabel('Total # of Public DAV Servers') lastdate = datetime.datetime.fromordinal(dates[len(dates) - 1]).strftime("%B %Y") pylab.xlabel("Data as of " + lastdate) pylab.title('Security Space Survey of\nPublic Subversion DAV Servers') # End drawing ########################################################### png = open(OUTPUT_FILE, 'w') pylab.savefig(png) png.close() os.rename(OUTPUT_FILE, OUTPUT_FILE + ".tmp.png") try: im = Image.open(OUTPUT_FILE + ".tmp.png", 'r') (width, height) = im.size print("Original size: %d x %d pixels" % (width, height)) scale = float(OUTPUT_IMAGE_WIDTH) / float(width) width = OUTPUT_IMAGE_WIDTH height = int(float(height) * scale) print("Final size: %d x %d pixels" % (width, height)) im = im.resize((width, height), Image.ANTIALIAS) im.save(OUTPUT_FILE, im.format) os.unlink(OUTPUT_FILE + ".tmp.png") except Exception as e: sys.stderr.write("Error attempting to resize the graphic: %s\n" % (str(e))) os.rename(OUTPUT_FILE + ".tmp.png", OUTPUT_FILE) raise pylab.close()
def chart_for_screen(screen): plt.figure(figsize=THUMB_SIZE) plt.grid(linestyle='-', color='0.9') data = screen.get_levels('nap') n = len(data) / (THUMB_SIZE[0]*THUMB_DPI) if n > 1: #use data thinning: take very nth row data = data[::n] if len(data)>0: x,y = zip(*data) plt.plot_date(x, y, '-') y = [screen.well.maaiveld] * len(x) plt.plot_date(x, y, '-') hand = screen.get_hand('nap') if len(hand)>0: x,y = zip(*hand) plt.plot_date(x, y, 'ro',label='handpeiling') plt.title(screen) plt.ylabel('m tov NAP') img = StringIO() plt.savefig(img,bbox_inches='tight', format='png') plt.close() return img.getvalue()
def plot_time(x, *extrap, **extrak): """ The same as plot_date, but takes in the time in sec since epoch instead of the matplotlib date format. (It can use the result of time.time()) Added Parameter: xrotation: which rotates the x ticks (defautls to 10 deg) xticksize: changes x axis thick size (defaults to 9) """ # uses the timezone set by pylab.rcParams['timezone'] x = time2date(x) xrotation = extrak.pop('xrotation', 10) xticksize = extrak.pop('xticksize', 9) ret = pylab.plot_date(x, *extrap, **extrak) ax = ret[0].axes # Rotate axes ticks # could also use self.fig.autofmt_xdate() lbls = ax.get_xticklabels() for l in lbls: l.update(dict(rotation=xrotation, size=xticksize)) pylab.draw() return ret
def chart_for_well(well): fig=plt.figure(figsize=THUMB_SIZE) ax=fig.gca() plt.grid(linestyle='-', color='0.9') count = 0 y = [] x = [] for screen in well.screen_set.all(): data = screen.get_levels('nap') n = len(data) / (THUMB_SIZE[0]*THUMB_DPI) if n > 1: #use data thinning: take very nth row data = data[::n] if len(data)>0: x,y = zip(*data) plt.plot_date(x, y, '-', label=screen) count += 1 hand = screen.get_hand('nap') if len(hand)>0: x,y = zip(*hand) plt.plot_date(x, y, 'ro', label='handpeiling') if len(x): y = [screen.well.maaiveld] * len(x) plt.plot_date(x, y, '-', label='maaiveld') plt.title(well) plt.ylabel('m tov NAP') if count > 0: leg=plt.legend() leg.get_frame().set_alpha(0.3) img = StringIO() plt.savefig(img,format='png',bbox_inches='tight') plt.close() return img.getvalue()
import os if not os.path.exists("plots"): os.makedirs("plots") import cuttsum.judgements ndf = cuttsum.judgements.get_merged_dataframe() for (event, title), group in df.groupby(["event", "title"]): matches = ndf[ndf["query id"] == event] # fig = plt.figure() group = group.set_index(["hour"]) # ax = group[["goose articles", "deduped articles", "deduped match articles"]].plot() linex = epoch(group.index[10]) ax = plt.plot(group.index, group["goose articles"], label="goose") ax = plt.plot(group.index, group["deduped articles"], label="dedupe") ax = plt.plot(group.index, group["deduped match articles"], label="dedupe qmatch") for nugget, ngroup in matches.groupby("nugget id"): times = ngroup["update id"].apply(lambda x: datetime.utcfromtimestamp(int(x.split("-")[0]))) # ngroup = ngroup.sort("timestamp") times.sort() times = times.reset_index(drop=True) if len(times) == 0: continue plt.plot_date((times[0], times[0]), (0, plt.ylim()[1]), "--", color="black", linewidth=0.5, alpha=0.5) plt.gcf().autofmt_xdate() plt.gcf().suptitle(title) plt.gcf().savefig(os.path.join("plots", "{}-stream.png".format(event))) plt.close("all")
ndf = cuttsum.judgements.get_merged_dataframe() for (event, title), group in df.groupby(["event", "title"]): matches = ndf[ndf["query id"] == event] #fig = plt.figure() group = group.set_index(["hour"]) #ax = group[["goose articles", "deduped articles", "deduped match articles"]].plot() linex = epoch(group.index[10]) ax = plt.plot(group.index, group["goose articles"], label="goose") ax = plt.plot(group.index, group["deduped articles"], label="dedupe") ax = plt.plot(group.index, group["deduped match articles"], label="dedupe qmatch") for nugget, ngroup in matches.groupby("nugget id"): times = ngroup["update id"].apply( lambda x: datetime.utcfromtimestamp(int(x.split("-")[0]))) #ngroup = ngroup.sort("timestamp") times.sort() times = times.reset_index(drop=True) if len(times) == 0: continue plt.plot_date((times[0], times[0]), (0, plt.ylim()[1]), '--', color="black", linewidth=.5, alpha=.5) plt.gcf().autofmt_xdate() plt.gcf().suptitle(title) plt.gcf().savefig(os.path.join("plots", "{}-stream.png".format(event))) plt.close("all")
def chart_for_well(well, start=None, stop=None, corrected=False): fig = plt.figure(figsize=THUMB_SIZE) ax = fig.gca() datemin = start or datetime.datetime(2013, 1, 1) datemax = stop or datetime.datetime(2019, 12, 31) if start or stop: ax.set_xlim(datemin, datemax) plt.grid(linestyle='-', color='0.9') ncol = 0 index = 0 singlescreen = well.screen_set.count() == 1 for screen in well.screen_set.all(): color = getcolor(index) ok = False if corrected: data = screen.mloc.series_set.filter( name__iendswith='corr').first() if data: data = data.to_pandas() if not data.empty: data = data.resample('H').mean() if not data.empty: plt.plot_date(data.index.to_pydatetime(), data.values, '-', label='filter {}'.format(screen.nr), color=color) ncol += 1 ok = True if not ok: data = screen.get_levels('nap', rule='H') if data: x, y = zip(*data) plt.plot_date(x, y, '-', label='filter {}'.format(screen.nr), color=color) ncol += 1 ok = True hand = screen.get_hand('nap') if hand and len(hand) > 0: x, y = zip(*hand) plt.plot_date(x, y, 'o', label='handpeiling {}'.format(screen.nr), markeredgecolor='white', markerfacecolor='red' if singlescreen else color) ncol += 1 index += 1 plt.ylabel('m tov NAP') mv = screen.well.maaiveld or screen.well.ahn if mv: plt.axhline(y=mv, linestyle='--', label='maaiveld', color='green') ncol += 1 plt.legend(bbox_to_anchor=(0.5, -0.1), loc='upper center', ncol=min(ncol, 5), frameon=False) plt.title(well) img = StringIO() plt.savefig(img, format='png', bbox_inches='tight') plt.close() return img.getvalue()
def generateGraphs(filename): print ('Starting: ' + filename) name = 'Blank' gender = 'Male' dob = 1900 goalWeight = 100 # kg fitLen = 10 # number of point to use in fit projectedMonths = 4 # number of months to project numOfPtsToAverage = 2 # rolling average of each point nPtsAvgFat = 1 # rolling average of each point idealRate = 0.5 # kg / week lib_formatting.plot_params['keepAxis'].append('right') lib_formatting.plot_params['margin']['bottom'] = 0.23 lib_formatting.plot_params['margin']['right'] = 0.13 lib_formatting.plot_params['dimensions']['width'] = 800 lib_formatting.plot_params['fontsize'] = 18 lib_formatting.format() weight = [] fat = [] with open(filename,'r') as f: for line in f.readlines(): line = line.strip('\r\n').split(',') if line != '': if len(line) == 1: setting = line[0].split(':') if setting[0]=='name': name = setting[1] elif setting[0]=='gender': gender = setting[1] elif setting[0]=='yearOfBirth': dob = int(setting[1]) elif setting[0]=='goalWeight': goalWeight = float(setting[1]) elif setting[0]=='fitLength': fitLen = int(setting[1]) elif setting[0]=='projectedMonths': projectedMonths = float(setting[1]) elif setting[0]=='nPtsAvgWeight': numOfPtsToAverage = int(setting[1]) elif setting[0]=='nPtsAvgFat': nPtsAvgFat = int(setting[1]) elif setting[0]=='idealWeightGain': idealRate = float(setting[1]) if len(line) > 1 and line[1] != '': weight.append(tuple([line[0], line[1]])) if len(line) == 3 and line[2] != '': fat.append(tuple([line[0], line[2]])) wstats = np.array(weight, dtype={'names':('date','weight'),'formats':('datetime64[D]','f')}) fstats = np.array(fat, dtype={'names':('date','fat'),'formats':('datetime64[D]','f')}) fatDates = list(map(lambda x: x.astype(datetime.datetime),fstats['date'])) fatDates = list(map(date2num, fatDates)) # Convert from numpy datetime64 to standard python datetime dates = map(lambda x: x.astype(datetime.datetime),wstats['date']) # Convert from datetime to matplotlib numerical representation of time dates = map(date2num, dates) dates, weights = filterData(dates,wstats['weight']) fdates, fats = filterData(fatDates,fstats['fat']) weights = averageData(weights, numOfPtsToAverage) L = len(dates) if L < fitLen: fitLen = L numDatesW = np.linspace(dates[-fitLen],datetime.date.today().toordinal()+projectedMonths*30, 100) fitW = np.poly1d(np.polyfit(dates[-fitLen:], weights[-fitLen:], 1)) fitWeights = fitW(numDatesW) rate = fitW(datetime.date.today().toordinal()+7) - fitW(datetime.date.today().toordinal()) goal = (goalWeight - fitW(datetime.date.today().toordinal()))*7/(rate*30) idealRate = np.linspace(0, projectedMonths*30/7, 20)*idealRate + fitW(datetime.date.today().toordinal()) idealRateDates = np.linspace(datetime.date.today().toordinal(), datetime.date.today().toordinal()+projectedMonths*30, 20) skinfold = fstats['fat'] skinfold = np.array(averageData(skinfold, nPtsAvgFat)) bFat = bodyFat(skinfold, dob, gender) L = len(fatDates) if L < fitLen: fitLen = L numDatesF = np.linspace(fatDates[-fitLen],datetime.date.today().toordinal()+projectedMonths*30, 100) fitF = np.poly1d(np.polyfit(fatDates[-fitLen:], bFat[-fitLen:], 1)) fitFat = fitF(numDatesF) # Plot the graphs plt.xticks(rotation=30) plt.grid() plt.plot_date(dates, weights, label="", color="#FF2F2F", mec="#FF2F2F", ms=3) plt.plot_date(numDatesW, fitWeights, linestyle='--', linewidth=1, label="", color="#FF2F2F", mec="#FF2F2F", ms=0) plt.plot_date(idealRateDates, idealRate, linestyle=':', linewidth=1, label="", color="#FF2F2F", mec="#FF2F2F", ms=0) ax1 = plt.gca() plt.text(0.85, 0.95, "{:2.2f}".format(rate) + ' kg/week', ha='center', va='center', transform=ax1.transAxes) plt.text(0.5, 0.95, "{:2.1f}".format(goal) + ' months to goal', ha='center', va='center', transform=ax1.transAxes) plt.gca().yaxis.set_major_formatter(FuncFormatter(lambda x, pos: '%0.1f' % (x))) ax1.set_ylabel("Weight $(kg)$", color="#FF2F2F") ax1.set_xlabel("Date") #ax1.legend(loc=0, frameon=False) ax2 = ax1.twinx() ax2.plot_date(fatDates, bFat, color="#2F2FFF", mec="#2F2FFF", ms=3) ax2.plot_date(numDatesF, fitFat, linestyle='--', linewidth=1, label="", color="#2F2FFF", mec="#2F2FFF", ms=0) ax2.set_ylabel("\% Fat", color="#2F2FFF") x1,x2,y1,y2 = plt.axis() plt.ylim((myround(y1-5, 5), myround(y2+5, 5))) plt.gca().yaxis.set_major_formatter(FuncFormatter(lambda x, pos: '%0.0f' % (x))) plt.savefig(name + '_all.pdf',type='pdf') plt.xlim((datetime.date.today().toordinal()-365+projectedMonths*30, datetime.date.today().toordinal()+projectedMonths*30)) plt.savefig(name + '_year.pdf',type='pdf') print ('Completed: ' + filename) print ()
# pl.title('t hmax') # pl.legend(('python','axys')) # #dirtp # pl.figure() # pl.plot_date(datam_py,dirtp_py,'bo') # pl.plot_date(datam_ax,dirtp_ax,'go',alpha=0.6) # pl.plot_date(datam_st,dirm_st,'ro',alpha=0.5) # pl.title('Dirtp - Rio_Grande_do_Sul') # pl.ylabel('graus') # pl.legend(('python','axys','site')) #subplot do periodo de dez 09 pl.figure() pl.subplot(3,1,1) pl.plot_date(datam_py,hs_py,'bo') pl.plot_date(datam_ax,hs_ax,'go',alpha=0.6) pl.plot_date(datam_st,hs_st,'ro',alpha=0.5) pl.axis([datam_py[0],datam_py[-1],0,10]) pl.title(local) pl.ylabel('Hs - metros') pl.legend(('lioc','axys','site')) pl.xticks(rotation=70) pl.subplot(3,1,2) pl.plot_date(datam_py,tp_py,'bo') pl.plot_date(datam_ax,tp_ax,'go',alpha=0.6) pl.plot_date(datam_st,tp_st,'ro',alpha=0.5) pl.axis([datam_py[0],datam_py[-1],0,20]) pl.ylabel('Tp - segundos') # pl.legend(('lioc','axys','site')) pl.subplot(3,1,3)
def chart_for_screen(screen, start=None, stop=None, raw=True, loggerpos=True, corrected=True): fig = plt.figure(figsize=THUMB_SIZE) ax = fig.gca() datemin = start or datetime.datetime(2013, 1, 1) datemax = stop or datetime.datetime(2019, 12, 31) if start or stop: ax.set_xlim(datemin, datemax) plt.grid(linestyle='-', color='0.9') ncol = 0 # sensor positie tov NAP berekenen en aan grafiek toevoegen if loggerpos and screen.refpnt is not None: depths = screen.loggerpos_set.filter( depth__isnull=False).order_by('start_date').values_list( 'start_date', 'end_date', 'depth') if len(depths) > 0: data = [] last = None for start, end, depth in depths: if last: data.append((start, last)) value = screen.refpnt - depth data.append((start, value)) last = value data.append((end, last)) x, y = zip(*data) plt.plot_date(x, y, '--', label='diverpositie', color='orange') ncol += 1 corr = screen.mloc.series_set.filter(name__iendswith='corr').first() hasCor = corr is not None and corr.aantal() > 0 rawShown = False if raw or not hasCor: data = screen.get_levels('nap', rule='H') if data is not None and len(data) > 0: x, y = zip(*data) plt.plot_date(x, y, '-', label='logger', color='blue') ncol += 1 rawShown = True # gecorrigeerde reeks toevoegen if corrected and hasCor: res = corr.to_pandas().resample(rule='H').mean() if not res.empty: if rawShown: label = 'gecorrigeerd' color = 'purple' else: label = 'logger' color = 'blue' plt.plot_date(res.index.to_pydatetime(), res.values, '-', label=label, color=color) ncol += 1 # handpeilingen toevoegen hand = screen.get_hand('nap') if hand is not None and len(hand) > 0: x, y = zip(*hand) plt.plot_date(x, y, 'o', label='handpeiling', color='red') ncol += 1 # maaiveld toevoegen plt.axhline(y=screen.well.maaiveld, linestyle='--', label='maaiveld', color='green') ncol += 1 plt.title(screen) plt.ylabel('m tov NAP') plt.legend(bbox_to_anchor=(0.5, -0.1), loc='upper center', ncol=ncol, frameon=False) img = StringIO() plt.savefig(img, bbox_inches='tight', format='png') plt.close() return img.getvalue()
# figura de particionamento espectral - ww3br # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 # header='data,hs,h10,hmax,tmed,thmax,hm0, tp, dp, sigma1p, sigma2p, hm01, tp1, dp1, hm02, tp2, dp2, gam, gam1, gam2') # escolhe o limite da plotagem lfi = pl.find(py[:, 0] == 200905010000) lfs = pl.find(py[:, 0] == 200905312300) # lfi = 0 # lfs = len(py) - 1 pl.figure() pl.title(local) pl.subplot(3, 1, 1) pl.plot_date(datam_py[lfi:lfs], py[lfi:lfs, 11], "go") # hm01 pl.plot_date(datam_py[lfi:lfs], py[lfi:lfs, 14], "ro") # hm02 pl.axis([datam_py[lfi], datam_py[lfs], 0, np.nanmax(py[lfi:lfs, 6])]) pl.xticks(visible=False) pl.grid() pl.ylabel("Hs - metros") pl.legend(["$swell$", "$windsea$"], loc=0) pl.subplot(3, 1, 2) pl.plot_date(datam_py[lfi:lfs], py[lfi:lfs, 12], "go", label="Tp1") # hm01 pl.plot_date(datam_py[lfi:lfs], py[lfi:lfs, 15], "ro", label="Tp2") # hm02 pl.axis([datam_py[lfi], datam_py[lfs], 0, 20]) pl.xticks(visible=False) pl.grid() pl.ylabel("Tp - seg")
#figura de particionamento espectral - ww3br # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #header='data,hs,h10,hmax,tmed,thmax,hm0, tp, dp, sigma1p, sigma2p, hm01, tp1, dp1, hm02, tp2, dp2, gam, gam1, gam2') #escolhe o limite da plotagem lfi = pl.find(py[:,0]==200905010000) lfs = pl.find(py[:,0]==200905312300) # lfi = 0 # lfs = len(py) - 1 pl.figure() pl.title(local) pl.subplot(3,1,1) pl.plot_date(datam_py[lfi:lfs],py[lfi:lfs,11],'go') #hm01 pl.plot_date(datam_py[lfi:lfs],py[lfi:lfs,14],'ro') #hm02 pl.axis([datam_py[lfi],datam_py[lfs],0,np.nanmax(py[lfi:lfs,6])]) pl.xticks(visible=False) pl.grid() pl.ylabel('Hs - metros') pl.legend(['$swell$','$windsea$'],loc=0) pl.subplot(3,1,2) pl.plot_date(datam_py[lfi:lfs],py[lfi:lfs,12],'go',label='Tp1') #hm01 pl.plot_date(datam_py[lfi:lfs],py[lfi:lfs,15],'ro',label='Tp2') #hm02 pl.axis([datam_py[lfi],datam_py[lfs],0,20]) pl.xticks(visible=False) pl.grid() pl.ylabel('Tp - seg')