diff --git a/JFSphoto.py b/JFSphoto.py index 39c175e..71b9da8 100644 --- a/JFSphoto.py +++ b/JFSphoto.py @@ -19,6 +19,7 @@ import time from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter from mpl_toolkits.mplot3d import Axes3D +from matplotlib.backend_bases import key_press_handler from tkinter import ttk import CCDpanelsetup as panel from sklearn.metrics import r2_score @@ -398,6 +399,14 @@ class Jfsphoto (object): def do_math(self,panel): + def onclick(event): + print('%s click: button=%d, xdata=%f, ydata=%f' %('double' if event.dblclick else 'single', event.button, + event.xdata, event.ydata)) + + def on_key_press(event): + print("you pressed {}".format(event.key)) + key_press_handler(event, self.canvas, self.toolbar1) + #print(panel.SHvalue.get()) #panel.bcollect.invoke() stati = [("Raw",1),("Raw + Baseline",2),("Transmission",4),("Absorbanz",3)] @@ -425,12 +434,19 @@ class Jfsphoto (object): self.ctr_right.grid(row=0, column=1, sticky="ns") self.fig = plt.Figure(figsize=(8,4),dpi=120) plt.rc('legend',fontsize=8) - self.ax1 = self.fig.add_subplot(111) + + self.ax1 = self.fig.add_subplot(2,3,(1,5)) + self.ax2 = self.fig.add_subplot(2,3,3) self.canvas = FigureCanvasTkAgg(self.fig, master = self.ctr_mid) self.canvas._tkcanvas.pack(side = tk.TOP, fill = tk.BOTH, expand = 1) self.toolbarFrame = tk.Frame(master=self.center,padx=5,pady=5) self.toolbarFrame.grid(row=1,columnspan=2, sticky="w") self.toolbar1 = NavigationToolbar2Tk(self.canvas, self.toolbarFrame) + + + + self.canvas.mpl_connect("key_press_event", on_key_press) + self.canvas.mpl_connect('button_press_event', onclick) #### Buttons n = 0 for txt,val in stati: @@ -553,13 +569,16 @@ class Jfsphoto (object): def look(self): self.ax1.clear() if self.proji3d==True: - self.ax1 = self.fig.gca(projection='3d') + self.ax1 = self.fig.add_subplot(2,3,(1,5),projection='3d') + #self.ax1 = self.fig.gca(projection='3d') else: - self.ax1 = self.fig.add_subplot(111) + self.ax1 = self.fig.add_subplot(2,3,(1,5)) if self.ok.get()==1: for xx in self.col_list: if self.proji3d==True: + self.ax1.set_ylabel('points') self.df.plot(x= 'nmscale',y = xx, zs= int(xx), linewidth=0.6,ax=self.ax1) + else: self.df.plot(x = 'nmscale',y = xx, linewidth=0.6,ax=self.ax1) elif self.ok.get()==2: