From 814a13d7710f9bbe962b3b15c72cf97079365b7c Mon Sep 17 00:00:00 2001 From: "Michele.Maris" <michele.maris@inaf.it> Date: Mon, 18 Mar 2024 09:28:41 +0100 Subject: [PATCH] u --- src/yapsut/graphics.py | 44 ++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/src/yapsut/graphics.py b/src/yapsut/graphics.py index 9041499..f7b9f38 100644 --- a/src/yapsut/graphics.py +++ b/src/yapsut/graphics.py @@ -340,36 +340,52 @@ class StandardFig() : labs = [l.get_label() for l in lns] self._handle['legend']=ax1.legend(lns, labs,ncol=ncol,loc=loc,fontsize=self.fontsize_legend if fontsize is None else fontsize,title=title,title_fontsize=fslt) return self._handle['legend'] - def title(self,txt,fontsize=None) : + def title(self,txt,fontsize=None,color=None) : from matplotlib import pyplot as plt + lk='title' fs=self.fontsize_title if fontsize is None else fontsize - self._handle['title']=plt.title(txt,fontsize=fs) - return self._handle['title'] - def suptitle(self,txt,fontsize=None) : + self._handle[lk]=plt.title(txt,fontsize=fs) + if not color is None : + self._handle[lk].set_color(color) + return self._handle[lk] + def suptitle(self,txt,fontsize=None,color=None) : from matplotlib import pyplot as plt + lk='suptitle' fs=self.fontsize_title if fontsize is None else fontsize - self._handle['suptitle']=plt.suptitle(txt,fontsize=fs) - return self._handle['suptitle'] - def xlabel(self,txt,fontsize=None) : + self._handle[lk]=plt.suptitle(txt,fontsize=fs) + if not color is None : + self._handle[lk].set_color(color) + return self._handle[lk] + def xlabel(self,txt,fontsize=None,color=None) : from matplotlib import pyplot as plt + lk='xlabel' fs=self.fontsize_xylabels if fontsize is None else fontsize - self._handle['xlabel']=plt.xlabel(txt,fontsize=fs) - return self._handle['xlabel'] - def ylabel(self,txt,fontsize=None) : + self._handle[lk]=plt.xlabel(txt,fontsize=fs) + if not color is None : + self._handle[lk].set_color(color) + return self._handle[lk] + def ylabel(self,txt,fontsize=None,color=None) : from matplotlib import pyplot as plt + lk='ylabel' fs=self.fontsize_xylabels if fontsize is None else fontsize - self._handle['ylabel']=plt.ylabel(txt,fontsize=fs) - return self._handle['ylabel'] - def XTICKS(self,ax=None,fontsize=None) : + self._handle[lk]=plt.ylabel(txt,fontsize=fs) + if not color is None : + self._handle[lk].set_color(color) + return self._handle[lk] + def XTICKS(self,ax=None,fontsize=None,color=None) : from matplotlib import pyplot as plt fs=self.fontsize_ticks if fontsize is None else fontsize aa=plt.gca().get_xticklabels() if ax is None else ax.get_xticklabels() for k in aa : k.set_fontsize(fs) - def YTICKS(self,ax=None,fontsize=None) : + if not color is None : + for k in aa : k.set_color(color) + def YTICKS(self,ax=None,fontsize=None,color=None) : from matplotlib import pyplot as plt fs=self.fontsize_ticks if fontsize is None else fontsize aa=plt.gca().get_yticklabels() if ax is None else ax.get_yticklabels() for k in aa : k.set_fontsize(fs) + if not color is None : + for k in aa : k.set_color(color) def gridspec(self,nrows,ncols,**kargs) : """ generates a GridSpec array. See matplotlib.gridspec.GridSpec """ import matplotlib.gridspec as gridspec -- GitLab