def plot_filelist(self, filelist, showPlot = True, eMail=None, pdf=None, web=False, config=None):
        emailText = []
        Tstamp = lambda HHMM: datetime.datetime(year=int(day[:4]), month=int(day[4:6]), day=int(day[6:8]),
                                                hour=int(HHMM[:2]), minute=int(HHMM[2:]))
        ## Sunrise and sunset shade
        #sun_rise = 6.0
        #sun_set  = 18.0
        #plt.axvspan(0.0, sun_rise, facecolor='blue', alpha=0.2)
        #plt.axvspan(sun_set, 24.0, facecolor='blue', alpha=0.2)

        if type(filelist) is str:
            if filelist.find(',') >= 0:  # file1,file2,...,fileN given as script argument
                filelist = filelist.split(",")
            else:
                filelist = (filelist, )
        filenames = []
        # use glob for one or more files
        filenames.extend([a for a in itertools.chain.from_iterable([glob.glob(f) for f in filelist])])
        #print (filenames)

        # plot's figure and axis
        fig = plt.figure()
        current_axes = fig.gca()
        current_axes.xaxis.set_minor_locator(matplotlib.dates.HourLocator())
        current_axes.xaxis.set_major_locator(matplotlib.dates.DayLocator())
        current_axes.xaxis.set_major_formatter(ff(self.m2yyyymmdd))
        current_axes.xaxis.set_minor_formatter(ff(self.m2hm))
        current_axes.set_xlabel("UTC Time")
        current_axes.set_ylabel("Signal Strength")

        ## Get data from files
        maxData, data_length = -1, -1; #  impossible values
        XRAlist = []      # flare list from NOAA
        daysList = set()  # date of NOAA's pages already retrieved, prevent multiple fetch
        figTitle = []     # list of file names (w/o path and extension) as figure's title
        # one color per station
        colorList = "brgcmy"
        colorStation = {}
        colorIdx = 0

        time.clock()
        for filename in sorted(filenames):
            figTitle.append(os.path.basename(filename)[:-4]) # extension .csv assumed
            sFile = SidFile(filename)
            for station in sFile.stations:
                # Does this station already have a color? if not, reserve one
                if station not in colorStation:
                    colorStation[station] = colorList[colorIdx % len(colorList)] + '-'  # format like 'b-'
                    colorIdx += 1
                # Add points to the plot
                plt.plot_date(sFile.timestamp, sFile.get_station_data(station), colorStation[station])
                # Extra housekeeping
                maxData = max(max(sFile.get_station_data(station)), maxData)  # maxData will be used later to put the XRA labels up
                #msg = str(len(sFile.get_station_data(station))) + " points plotted after reading " + os.path.basename(filename)
                msg = "[{}] {} points plotted after reading {}".format(station, len(sFile.get_station_data(station)), os.path.basename(filename))
                print(msg)
                emailText.append(msg)

                if web and sFile.startTime not in daysList:
                    # get the XRA data from NOAA website to draw corresponding lines on the plot
                    # fetch that day's flares on NOAA as not previously accessed
                    day = sFile.sid_params["utc_starttime"][:10].replace("-","")
                    #NOAA_URL = 'http://www.swpc.noaa.gov/ftpdir/warehouse/%s/%s_events/%sevents.txt' % (day[:4], day[:4], day)
                    #ftp://ftp.swpc.noaa.gov/pub/indices/events/20141030events.txt
                    NOAA_URL = 'ftp://ftp.swpc.noaa.gov/pub/indices/events/%sevents.txt' % (day)
                    response = None
                    if sys.version[0]<'3':  # python 2.7 vs. Python 3.3
                        try:
                            response = urllib2.urlopen(NOAA_URL)
                        except urllib2.HTTPError as err:                            
                            print(err,"\n",NOAA_URL)
                    else:
                        try:
                            response = urllib.request.urlopen(NOAA_URL)
                        except urllib.error.HTTPError as err:                            
                            print(err,"\n",NOAA_URL)
                    lastXRAlen = len(XRAlist) # save temporarly current number of XRA events in memory
                    if response:
                        for webline in response.read().splitlines():
                            if sys.version[0]>='3': webline = str(webline, 'utf-8') # Python 3: cast bytes to str
                            fields = webline.split()
                            if len(fields) >= 9 and not fields[0].startswith("#"):
                                if fields[1] == '+': fields.remove('+')
                                if fields[6] in ('XRA', ):  # maybe other event types could be of interrest
                                    #     eventName,    BeginTime,    MaxTime,      EndTime,      Particulars
                                    msg = fields[0]+" "+fields[1]+" "+fields[2]+" "+fields[3]+" "+fields[8]
                                    emailText.append(msg)
                                    print(msg)
                                    try:
                                        btime = Tstamp(fields[1])   # 'try' necessary as few occurences of --:-- instead of HH:MM exist
                                    except:
                                        pass
                                    try:
                                        mtime = Tstamp(fields[2])
                                    except:
                                        mtime = btime
                                    try:
                                        etime = Tstamp(fields[3])
                                    except:
                                        etime = mtime
                                    XRAlist.append( (fields[0], btime, mtime, etime, fields[8]) )  # as a tuple

                    msg = str(len(XRAlist) - lastXRAlen) + " XRA events recorded by NOAA on " + day
                    emailText.append(msg)
                    print(msg)
                # keep track of the days
                daysList.add(sFile.startTime)

        print("All files read in", time.clock(), "sec.")

        if web: # add the lines marking the retrieved flares from NOAA
            alternate = 0
            for eventName, BeginTime, MaxTime, EndTime, Particulars in XRAlist:
                plt.vlines( [BeginTime, MaxTime, EndTime], 0, maxData,
                            color=['g','r','y'], linestyles='dotted')
                plt.text(MaxTime, alternate * maxData, Particulars, horizontalalignment='center',
                         bbox=dict(fill=True, alpha=0.5, facecolor='w'))
                alternate = 0 if alternate==1 else 1


        # plot/page size / figure size with on A4 paper
        if len(daysList) == 1:
            fig.set_size_inches(29.7 / 2.54, 21.0 / 2.54, forward=True)
        else:  # allow PDF poster for many days (monthly graph) --> use Adobe PDF Reader --> Print --> Poster mode
            fig.set_size_inches((29.7 / 2.54) * (len(daysList)/2.0), (21.0 / 2.54) / 2.0, forward=True)
        fig.subplots_adjust(bottom=0.08, left = 0.05, right = 0.98, top=0.95)

        # some cosmetics on the figure
        for label in current_axes.xaxis.get_majorticklabels():
            label.set_fontsize(8)
            label.set_rotation(30)  # 'vertical')
            #label.set_horizontalalignment='left'

        for label in current_axes.xaxis.get_minorticklabels():
            label.set_fontsize(12 if len(daysList) == 1 else 8)

        fig.suptitle(", ".join(figTitle))

        xLegend = 0.03
        for station, color in colorStation.items():
            fig.text(xLegend, 0.93, station, color=color[0], fontsize=12, bbox={'fc':"w", 'pad':10, 'ec':color[0]})
            xLegend += 0.05

        # actions requested by user
        if pdf or eMail:
            pp = PdfPages(pdf or 'Image.pdf')  # in case option eMail is given but not pdf
            plt.savefig(pp, format='pdf')
            pp.close()
        if showPlot: plt.show()
        if eMail: sendMail(config, eMail, "\n".join(emailText), pdf or 'Image.pdf')


#-------------------------------------------------------------------------------
Put a new element in the queue.
dataset/ETHPy150Open ericgibert/supersid/supersid/supersid_plot.py/SUPERSID_PLOT.plot_filelist--crossover with--dataset/ETHPy150Open flaviogrossi/sockjs-cyclone/sockjs/cyclone/utils.py/PriorityQueue.push