def plot_arai(self, component='m', show_std=True, out='show', plt_opt={}): colors = get_colors() components = {'x': 1, 'y': 2, 'z': 3, 'm': 4} if not 'color' in plt_opt: plt_opt.update({'color': colors[0]}) idx = components[component] th_mean = self.get_data_mean(step='th') ptrm_mean = self.get_data_mean(step='ptrm') th_max = self.get_data_max(step='th') ptrm_max = self.get_data_max(step='ptrm') th_stdev = self.get_data_stdev(step='th') ptrm_stdev = self.get_data_stdev(step='ptrm') plt.plot(ptrm_mean[:, idx], th_mean[:, idx], '.-', **plt_opt) if show_std: plt.fill_between(ptrm_mean[:, idx], th_mean[:, idx] + th_stdev[:, idx], th_mean[:, idx] - th_stdev[:, idx], color=colors[0], alpha=0.1, antialiased=True) # plt.fill_betweenx(th_mean[:,idx]-th_stdev[:,idx], ptrm_mean[:,idx], ptrm_mean[:,idx]-ptrm_stdev[:,idx], # where= th_stdev[:,idx]-th_stdev[:,idx] < th_stdev[:,idx], # color=colors[1], alpha = 0.1, antialiased=True) # plt.fill_betweenx(th_mean[:,idx]+th_stdev[:,idx], ptrm_mean[:,idx], ptrm_mean[:,idx]+ptrm_stdev[:,idx], # where= th_stdev[:,idx]+th_stdev[:,idx] > th_stdev[:,idx], # color=colors[1], alpha = 0.1, antialiased=True) if out == 'show': plt.xlabel(r'pTRM gained') plt.ylabel(r'NRM remaining') plt.show() if out == 'rtn': return
def plot_dunlop(self, component='m', show_std=True, out='show', plt_opt=None): if not plt_opt: plt_opt = {} colors = get_colors() components = {'x': 1, 'y': 2, 'z': 3, 'm': 4} idx = components[component] th_mean = self.get_data_mean(step='th') ptrm_mean = self.get_data_mean(step='ptrm') sum_mean = np.c_[th_mean[:, 0], th_mean[:, 1:] + ptrm_mean[:, 1:]] th_max = self.get_data_max(step='th') ptrm_max = self.get_data_max(step='ptrm') sum_max = self.get_data_max(step='sum') th_stdev = self.get_data_stdev(step='th') ptrm_stdev = self.get_data_stdev(step='ptrm') sum_stdev = np.c_[th_stdev[:, 0], th_stdev[:, 1:] + ptrm_stdev[:, 1:]] plt.plot(th_mean[:, 0], th_mean[:, idx], '.-', color=colors[1], **plt_opt) plt.plot(ptrm_mean[:, 0], ptrm_mean[:, idx], '.-', color=colors[2], **plt_opt) plt.plot(sum_mean[:, 0], sum_mean[:, idx], '.-', color=colors[0], **plt_opt) if show_std: plt.fill_between(th_mean[:, 0], th_mean[:, idx] - th_stdev[:, idx], th_mean[:, idx] + th_stdev[:, idx], color=colors[1], alpha=0.1) plt.fill_between(ptrm_mean[:, 0], ptrm_mean[:, idx] - ptrm_stdev[:, idx], ptrm_mean[:, idx] + ptrm_stdev[:, idx], color=colors[2], alpha=0.1) plt.fill_between(sum_mean[:, 0], sum_mean[:, idx] - sum_stdev[:, idx], sum_mean[:, idx] + sum_stdev[:, idx], color=colors[0], alpha=0.1) if out == 'show': plt.xlabel(r'Temperature [$^\circ C$]') plt.ylabel(r'Normalized Magnetic Moment') plt.show() if out == 'rtn': return
def __init__( self, sample_list, norm=None, log=None, plot="show", folder=None, name="output.pdf", plt_opt={}, **options ): self.colors = helper.get_colors() self.plot_marker = options.get("marker", True) self.markers = helper.get_marker() self.lines = ["-", "--", ":", "-."] matplotlib.rcParams.update({"font.size": 10}) params = { "backend": "ps", "text.latex.preamble": [r"\usepackage{upgreek}", r"\usepackage[nice]{units}"], "axes.labelsize": 12, "text.fontsize": 12, "legend.fontsize": 8, "xtick.labelsize": 10, "ytick.labelsize": 10, # 'text.usetex': True, "axes.unicode_minus": True, "axes.color_cycle": self.colors, } plt.rcParams.update(params) self.x_label = None self.y_label = None self.plot = plot if not log: self.log = logging.getLogger("RockPy.PLOTTING") else: self.log = logging.getLogger(log) if type(sample_list) is not list: self.log.debug("CONVERTING Sample Instance to Samples List") sample_list = [sample_list] self.name = name if folder is None: from os.path import expanduser folder = expanduser("~") + "/Desktop/" self.folder = folder self.norm = norm self.samples = [i for i in sample_list] self.sample_list = self.samples self.fig1 = options.get("fig", plt.figure(figsize=(8, 6), dpi=100)) self.ax = plt.subplot2grid((1, 1), (0, 0), colspan=1, rowspan=1) self.plot_data = [] self.ax.xaxis.major.formatter._useMathText = True self.ax.yaxis.major.formatter._useMathText = True self.ax.ticklabel_format(style="sci", scilimits=(1, 4), axis="both") # plt.rc('axes', color_cycle=['k', 'm', 'y', 'c']) plt.rc("axes", color_cycle=self.colors)