Example #1
0
                            0.95,
                            text2,
                            transform=ax2.transAxes,
                            fontsize=14,
                            verticalalignment='top',
                            horizontalalignment='left',
                            bbox=patch_properties)

        # make a splan selector and have it turned off initially until user
        # presses 'q' or 'a' on the key board via toggle_selector
        span = SpanSelector(ax1,
                            onselect,
                            'horizontal',
                            useblit=True,
                            rectprops=dict(alpha=0.5, facecolor='red'))
        span.visible = False

        # connect span with the toggle selector in order to toggle span selector on and off
        span.connect_event('key_press_event', toggle_selector)

        # make sure that the layout of the subplots do not overlap
        plt.tight_layout()
        plt.show()

    except IOError as error:
        print 'cannot read file' + error.filename
        print error.message

    except IndexError as error:
        print 'Cannot read file! Bad file!'
        print error.message
Example #2
0
     
     # show text of mean, max, min values on graph; use matplotlib.patch.Patch properies and bbox
     text2 = 'mean = %.2f\nmax = %.2f\nmin = %.2f' % (parameter['mean'], parameter['max'], parameter['min'])
     patch_properties = {'boxstyle': 'round',
                         'facecolor': 'wheat',
                         'alpha': 0.5
                         }
                    
     ax2_text = ax2.text(0.05, 0.95, text2, transform = ax2.transAxes, fontsize = 14, 
                          verticalalignment = 'top', horizontalalignment = 'left', bbox = patch_properties)
             
     # make a splan selector and have it turned off initially until user 
     # presses 'q' or 'a' on the key board via toggle_selector
     span = SpanSelector(ax1, onselect, 'horizontal', useblit=True,
                         rectprops=dict(alpha=0.5, facecolor='red'))
     span.visible = False
             
     # connect span with the toggle selector in order to toggle span selector on and off
     span.connect_event('key_press_event', toggle_selector)        
     
     # make sure that the layout of the subplots do not overlap
     plt.tight_layout()
     plt.show()
             
 except IOError as error:
     print 'cannot read file' + error.filename
     print error.message
     
 except IndexError as error:
     print 'Cannot read file! Bad file!'
     print error.message