Changeset 13074 for fact


Ignore:
Timestamp:
03/12/12 16:32:11 (13 years ago)
Author:
neise
Message:
solved an issue with CamPlotter, when calling it from a different folder. maybe this was not yet fully understood by me. And plotting histograms without a labe is now possible
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/pyscripts/pyfact/plotters.py

    r13019 r13074  
    88import numpy as np
    99import matplotlib.pyplot as plt
     10import os.path
     11import sys
    1012
    1113class Plotter(object):
     
    7678    def __init__(self, name, ion=True, grid=True, fname=None, map_file_path = '../map_dn.txt', vmin=None, vmax=None):
    7779        """ initialize the object """
     80        path = os.path.abspath(__file__)
     81        path = os.path.dirname(path)
     82        map_file_path = os.path.join(path, map_file_path)
     83        if not os.path.isfile(map_file_path):
     84            print 'not able to find file:', map_file_path
     85            sys.exit(-2)
     86           
    7887        self.name  = name
    79        
    8088        if ion:
    8189            plt.ion()
     
    142150        if ydata.ndim > 1:
    143151            ydata = ydata.flatten()
    144        
    145         plt.hist(ydata, bins, range, label=label, log=log)
    146152        if label:
     153            plt.hist(ydata, bins, range, label=label, log=log)
    147154            plt.legend()
     155        else:
     156            plt.hist(ydata, bins, range, log=log)
     157           
    148158        plt.title(self.name)
    149159       
Note: See TracChangeset for help on using the changeset viewer.