Beispiel #1
0
	def draw_graph(self):

		n=0
		if (len(self.time)>0):
			mul,unit=time_with_units(float(self.time[len(self.time)-1]-self.time[0]))
		else:
			mul=1.0
			unit="s"

		time=[]
		for i in range(0,len(self.time)):
			time.append(self.time[i]*mul)
		self.fig.clf()
		self.fig.subplots_adjust(bottom=0.2)
		self.fig.subplots_adjust(left=0.1)
		self.ax1 = self.fig.add_subplot(111)
		self.ax1.ticklabel_format(useOffset=False)
		#ax2 = ax1.twinx()
		x_pos=0.0
		layer=0
		color =['r','g','b','y','o','r','g','b','y','o']

		self.ax1.set_ylabel(_("Voltage (Volts)"))

		voltage, = self.ax1.plot(time,self.voltage, 'ro-', linewidth=3 ,alpha=1.0)
		self.ax1.set_xlabel(_("Time (")+unit+')')

		self.ax2 = self.ax1.twinx()
		self.ax2.set_ylabel(_("Magnitude (au)"))
		#ax2.set_ylabel('Energy (eV)')

		sun, = self.ax2.plot(time,self.sun, 'go-', linewidth=3 ,alpha=1.0)
		if debug_mode()==True:
			laser, = self.ax2.plot(time,self.laser, 'bo-', linewidth=3 ,alpha=1.0)

		fs_laser_enabled=False
		if self.fs_laser_time!=-1:
			if len(self.time)>2:
				dt=(self.time[len(time)-1]-self.time[0])/100
				start=self.fs_laser_time-dt*5
				stop=self.fs_laser_time+dt*5
				x = linspace(start,stop,100)
				y=self.gaussian(x,self.fs_laser_time,dt)
				#print y

				fs_laser, = self.ax2.plot(x*mul,y, 'g-', linewidth=3 ,alpha=1.0)
				fs_laser_enabled=True
				self.ax2.ticklabel_format(style='sci', axis='x', scilimits=(0,0))

		if debug_mode()==True:
			if fs_laser_enabled==True:
				self.fig.legend((voltage, sun, laser,fs_laser), (_("Voltage"), _("Sun"), _("CW laser"), _("fs laser")), 'upper right')
			else:
				self.fig.legend((voltage, sun, laser), (_("Voltage"), _("Sun"), _("CW laser")), 'upper right')
		else:
			if fs_laser_enabled==True:
				self.fig.legend((voltage, sun, fs_laser), (_("Voltage"), _("Sun"), _("fs laser")), 'upper right')
			else:
				self.fig.legend((voltage, sun), (_("Voltage"), _("Sun")), 'upper right')
Beispiel #2
0
    def draw_graph(self):
        if (len(self.time) > 0):
            mul, unit = time_with_units(
                float(self.time[len(self.time) - 1] - self.time[0]))
        else:
            mul = 1.0
            unit = "s"

        time = []
        for i in range(0, len(self.time)):
            time.append(self.time[i] * mul)
        self.fig.clf()
        self.fig.subplots_adjust(bottom=0.2)
        self.fig.subplots_adjust(left=0.1)

        self.ax1 = self.fig.add_subplot(211)
        self.ax1.ticklabel_format(useOffset=False)
        self.ax1.spines['right'].set_visible(False)
        self.ax1.spines['top'].set_visible(False)
        self.ax1.yaxis.set_ticks_position('left')
        self.ax1.xaxis.set_ticks_position('bottom')
        self.ax1.yaxis.set_major_locator(ticker.MaxNLocator(4))
        self.ax1.set_ylabel(_("Voltage (Volts)"))
        self.ax1.set_xticklabels([])
        self.ax1.grid(True)
        voltage, = self.ax1.plot(time,
                                 self.voltage,
                                 'ro-',
                                 linewidth=3,
                                 alpha=1.0)

        self.ax2 = self.fig.add_subplot(212)
        self.ax2.spines['right'].set_visible(False)
        self.ax2.spines['top'].set_visible(False)
        self.ax2.yaxis.set_ticks_position('left')
        self.ax2.xaxis.set_ticks_position('bottom')
        self.ax2.yaxis.set_major_locator(ticker.MaxNLocator(4))
        self.ax2.set_ylabel(_("Suns") + " (Suns)")
        self.ax2.set_xlabel(_("Time") + " (" + unit + ')')
        self.ax2.grid(True)
        sun, = self.ax2.plot(time, self.sun, 'go-', linewidth=3, alpha=1.0)

        if enable_betafeatures() == True:
            laser, = self.ax2.plot(time,
                                   self.laser,
                                   'bo-',
                                   linewidth=3,
                                   alpha=1.0)

        fs_laser_enabled = False
        if self.fs_laser_time != -1:
            if len(self.time) > 2:
                dt = (self.time[len(time) - 1] - self.time[0]) / 100
                start = self.fs_laser_time - dt * 5
                stop = self.fs_laser_time + dt * 5
                x = linspace(start, stop, 100)
                y = self.gaussian(x, self.fs_laser_time, dt)
                #print y

                fs_laser, = self.ax2.plot(x * mul,
                                          y,
                                          'g-',
                                          linewidth=3,
                                          alpha=1.0)
                fs_laser_enabled = True
                self.ax2.ticklabel_format(style='sci',
                                          axis='x',
                                          scilimits=(0, 0))

        self.fig.subplots_adjust(hspace=0)
Beispiel #3
0
	def do_plot(self):
		#print("PLOT TYPE=",self.plot_token.type)
		if self.plot_token!=None and len(self.plot_id)!=0:
			plot_number=0
			#print(">>>>>>>>>>>>",self.plot_token.x_len,self.plot_token.y_len,self.plot_token.z_len)
			self.fig.clf()
			self.fig.subplots_adjust(bottom=0.2)
			self.fig.subplots_adjust(bottom=0.2)
			self.fig.subplots_adjust(left=0.1)
			self.fig.subplots_adjust(hspace = .001)

			title=""
			if self.plot_title=="":
				title=self.plot_token.title
			else:
				title=self.plot_title

			if self.plot_token.time!=-1.0 and self.plot_token.Vexternal!=-1.0:
				mul,unit=time_with_units(self.plot_token.time)
				title=title+" V="+str(self.plot_token.Vexternal)+" time="+str(self.plot_token.time*mul)+" "+unit

			self.fig.suptitle(title)

			self.ax=[]
			number_of_plots=max(self.plot_id)+1
			if self.plot_token.type=="heat":
				number_of_plots=1




			for i in range(0,number_of_plots):
				self.ax.append(self.fig.add_subplot(number_of_plots,1,i+1, axisbg='white'))
				#Only place label on bottom plot
				if i==number_of_plots-1:
					#print(self.plot_token.x_label,self.plot_token.x_units)
					self.ax[i].set_xlabel(self.plot_token.x_label+" ("+str(self.plot_token.x_units)+")")

				else:
					self.ax[i].tick_params(axis='x', which='both', bottom='off', top='off',labelbottom='off') # labels along the bottom edge are off

				#Only place y label on center plot
				if self.plot_token.normalize==True or self.plot_token.norm_to_peak_of_all_data==True:
					y_text="Normalized "+self.plot_token.y_label
					y_units="au"
				else:
					y_text=self.plot_token.y_label
					y_units=self.plot_token.y_units
				if i==math.trunc(number_of_plots/2):
					self.ax[i].set_ylabel(y_text+" ("+y_units+")")

				if self.plot_token.logx==True:
					self.ax[i].set_xscale("log")

				if self.plot_token.logy==True:
					self.ax[i].set_yscale("log")


			lines=[]
			files=[]
			data=dat_file()
			my_max=1.0

			if self.plot_token.x_len==1 and self.plot_token.z_len==1:

				all_max=1.0
				if self.plot_token.norm_to_peak_of_all_data==True:
					my_max=-1e40
					for i in range(0, len(self.input_files)):
						if self.read_data_file(data,i)==True:
							local_max,my_min=dat_file_max_min(data)
							if local_max>my_max:
								my_max=local_max
					all_max=my_max

				for i in range(0, len(self.input_files)):
					if self.read_data_file(data,i)==True:
						if all_max!=1.0:
							for x in range(0,data.x_len):
								for y in range(0,data.y_len):
									for z in range(0,data.z_len):
										data.data[z][x][y]=data.data[z][x][y]/all_max

						Ec, = self.ax[plot_number].plot(data.y_scale,data.data[0][0], linewidth=3 ,alpha=1.0,color=self.color[i],marker=self.marker[i])

						#label data if required
						#if self.plot_token.label_data==True:
						#	for ii in range(0,len(t)):
						#		if z[ii]!="":
						#			fx_unit=fx_with_units(float(z[ii]))
						#			label_text=str(float(z[ii])*fx_unit[0])+" "+fx_unit[1]
						#			self.ax[plot_number].annotate(label_text,xy = (t[ii], s[ii]), xytext = (-20, 20),textcoords = 'offset points', ha = 'right', va = 'bottom',bbox = dict(boxstyle = 'round,pad=0.5', fc = 'yellow', alpha = 0.5),arrowprops = dict(arrowstyle = '->', connectionstyle = 'arc3,rad=0'))

						#if number_of_plots>1:
						#	self.ax[plot_number].yaxis.set_major_formatter(ticker.FormatStrFormatter('%0.1e'))
						#	if min(s)!=max(s):
						#		print("TICKS=",(max(s)-min(s))/4.0)
						#		self.ax[plot_number].yaxis.set_ticks(arange(min(s), max(s), (max(s)-min(s))/4.0 ))

						#print("roderick",self.labels,i,self.labels[i])
						if self.labels[i]!="":
							#print "Rod=",self.labels[i]
							#print self.plot_token.key_units
							files.append("$"+numbers_to_latex(str(self.labels[i]))+" "+pygtk_to_latex_subscript(self.plot_token.key_units)+"$")

							lines.append(Ec)

				self.lx = None
				self.ly = None
				if self.plot_token.legend_pos=="No key":
					self.ax[plot_number].legend_ = None
				else:
					self.fig.legend(lines, files, self.plot_token.legend_pos)
			elif self.plot_token.x_len>1 and self.plot_token.y_len>1 and self.plot_token.z_len==1:		#3d plot
				data=dat_file()

				if self.read_data_file(data,0)==True:
					im=self.ax[0].pcolor(data.y_scale,data.x_scale,data.data[0])
					self.fig.colorbar(im)
					#self.ax[0].plot_surface(x, y, z, rstride=1, cstride=1, cmap=cm.coolwarm,linewidth=0, antialiased=False)
					#self.ax[0].invert_yaxis()
					#self.ax[0].xaxis.tick_top()
			elif self.plot_token.type=="heat":
				x=[]
				y=[]
				z=[]

				pos=float(self.plot_token.x_start)
				x_step=(float(self.plot_token.x_stop)-float(self.plot_token.x_start))/self.plot_token.x_points
				while(pos<float(self.plot_token.x_stop)):
					x.append(pos)
					pos=pos+x_step

				pos=float(self.plot_token.y_start)
				y_step=(float(self.plot_token.y_stop)-float(self.plot_token.y_start))/self.plot_token.y_points
				while(pos<float(self.plot_token.y_stop)):
					y.append(pos)
					pos=pos+y_step

				data = zeros((len(y),len(x)))

				for ii in range(0,len(self.input_files)):
					t=[]
					s=[]
					z=[]
					if self.read_data_file(t,s,z,ii)==True:
						#print(self.input_files[ii])
						for points in range(0,len(t)):
							found=0
							if t[points]>x[0]:
								for x_pos in range(0,len(x)):
									if x[x_pos]>t[points]:
										found=found+1
										break

							if s[points]>y[0]:
								for y_pos in range(0,len(y)):
									if y_pos!=0:
										if y[y_pos]>s[points]:
											found=found+1
											break
							if found==2:
								#print("adding data at",x_pos,y_pos)
								if data[y_pos][x_pos]<10.0:
									data[y_pos][x_pos]=data[y_pos][x_pos]+1
							else:
								print("not adding point",t[points],s[points])

				#print(x)
				#print(y)
				#print(data)
				x_grid, y_grid = mgrid[float(self.plot_token.y_start):float(self.plot_token.y_stop):complex(0, len(y)), float(self.plot_token.x_start):float(self.plot_token.x_stop):complex(0, len(x))]
				self.ax[0].pcolor(y_grid,x_grid,data)
				
			else:
				x=[]
				y=[]
				z=[]

				if read_data_2d(x,y,z,self.input_files[0])==True:
					#print(len(x),len(y),len(z),self.input_files[0])
					maxx=-1
					maxy=-1
					for i in range(0,len(z)):
						if x[i]>maxx:
							maxx=x[i]

						if y[i]>maxy:
							maxy=y[i]

					maxx=maxx+1
					maxy=maxy+1

					data = zeros((maxy,maxx))


					for i in range(0,len(z)):
						data[y[i]][x[i]]= random.random()+5
						self.ax[0].text(x[i], y[i]+float(maxy)/float(len(z))+0.1,'%.1e' %  z[i], fontsize=12)

					#fig, ax = plt.subplots()
					self.ax[0].pcolor(data,cmap=plt.cm.Blues)
					
					self.ax[0].invert_yaxis()
					self.ax[0].xaxis.tick_top()

			#self.fig.tight_layout(pad=0.0, w_pad=0.0, h_pad=0.0)
			self.fig.canvas.draw()
Beispiel #4
0
    def draw_graph(self):
        if (len(self.time) > 0):
            mul, unit = time_with_units(
                float(self.time[len(self.time) - 1] - self.time[0]))
        else:
            mul = 1.0
            unit = "s"

        time = []
        for i in range(0, len(self.time)):
            time.append(self.time[i] * mul)
        self.fig.clf()
        self.fig.subplots_adjust(bottom=0.2)
        self.fig.subplots_adjust(left=0.1)
        self.ax1 = self.fig.add_subplot(111)
        self.ax1.ticklabel_format(useOffset=False)
        #ax2 = ax1.twinx()
        #x_pos=0.0
        #layer=0
        #color =['r','g','b','y','o','r','g','b','y','o']

        self.ax1.set_ylabel(_("Voltage (Volts)"))

        voltage, = self.ax1.plot(time,
                                 self.voltage,
                                 'ro-',
                                 linewidth=3,
                                 alpha=1.0)
        self.ax1.set_xlabel(_("Time") + " (" + unit + ')')

        self.ax2 = self.ax1.twinx()
        self.ax2.set_ylabel(_("Magnitude") + " (au)")
        #ax2.set_ylabel('Energy (eV)')

        sun, = self.ax2.plot(time, self.sun, 'go-', linewidth=3, alpha=1.0)
        if enable_betafeatures() == True:
            laser, = self.ax2.plot(time,
                                   self.laser,
                                   'bo-',
                                   linewidth=3,
                                   alpha=1.0)

        fs_laser_enabled = False
        if self.fs_laser_time != -1:
            if len(self.time) > 2:
                dt = (self.time[len(time) - 1] - self.time[0]) / 100
                start = self.fs_laser_time - dt * 5
                stop = self.fs_laser_time + dt * 5
                x = linspace(start, stop, 100)
                y = self.gaussian(x, self.fs_laser_time, dt)
                #print y

                fs_laser, = self.ax2.plot(x * mul,
                                          y,
                                          'g-',
                                          linewidth=3,
                                          alpha=1.0)
                fs_laser_enabled = True
                self.ax2.ticklabel_format(style='sci',
                                          axis='x',
                                          scilimits=(0, 0))

        if enable_betafeatures() == True:
            if fs_laser_enabled == True:
                self.fig.legend(
                    (voltage, sun, laser, fs_laser),
                    (_("Voltage"), _("Sun"), _("CW laser"), _("fs laser")),
                    'upper right')
            else:
                self.fig.legend((voltage, sun, laser),
                                (_("Voltage"), _("Sun"), _("CW laser")),
                                'upper right')
        else:
            if fs_laser_enabled == True:
                self.fig.legend((voltage, sun, fs_laser),
                                (_("Voltage"), _("Sun"), _("fs laser")),
                                'upper right')
            else:
                self.fig.legend((voltage, sun), (_("Voltage"), _("Sun")),
                                'upper right')
Beispiel #5
0
	def do_plot(self):
		if len(self.data)==0:
			return
		
		if self.data[0].valid_data==False:
			return

		self.fig.clf()
		self.fig.subplots_adjust(bottom=0.2)
		self.fig.subplots_adjust(bottom=0.2)
		self.fig.subplots_adjust(left=0.1)
		self.fig.subplots_adjust(hspace = .001)
		dim=""
		if self.data[0].x_len==1 and self.data[0].z_len==1:
			dim="linegraph"
		elif self.data[0].x_len>1 and self.data[0].y_len>1 and self.data[0].z_len==1:
			if self.data[0].type=="3d":
				dim="wireframe"
			if self.data[0].type=="heat":
				dim="heat"
		elif self.data[0].x_len>1 and self.data[0].y_len>1 and self.data[0].z_len>1:
			print("ohhh full 3D")
			dim="3d"
		else:
			print(_("I don't know how to process this type of file!"),self.data[0].x_len, self.data[0].y_len,self.data[0].z_len)
			return

		title=self.data[0].title
		if self.data[0].time!=-1.0 and self.data[0].Vexternal!=-1.0:
			mul,unit=time_with_units(self.data[0].time)
			title=self.data[0].title+" V="+str(self.data[0].Vexternal)+" "+_("time")+"="+str(self.data[0].time*mul)+" "+unit

		self.fig.suptitle(title)

		self.setWindowTitle(title+" - www.gpvdm.com")

		self.ax=[]


		for i in range(0,len(self.input_files)):
			if dim=="linegraph":
				self.ax.append(self.fig.add_subplot(111,axisbg='white'))
			elif dim=="wireframe":
				self.ax.append(self.fig.add_subplot(111,axisbg='white' ,projection='3d'))
			elif dim=="heat":
				self.ax.append(self.fig.add_subplot(111,axisbg='white'))
			elif dim=="3d":
				self.ax.append(self.fig.add_subplot(111,axisbg='white' ,projection='3d'))
			#Only place label on bottom plot
			#	if self.data[i].type=="3d":
			#else:
			#	self.ax[i].tick_params(axis='x', which='both', bottom='off', top='off',labelbottom='off') # labels along the bottom edge are off

			#Only place y label on center plot
			if self.data[0].normalize==True or self.data[0].norm_to_peak_of_all_data==True:
				y_text="Normalized "+self.data[0].data_label
				data_units="au"
			else:
				data_text=self.data[i].data_label
				data_units=self.data[i].data_units

			if self.data[0].logx==True:
				self.ax[i].set_xscale("log")

			if self.data[0].logy==True:
				self.ax[i].set_yscale("log")


		all_plots=[]
		files=[]
		my_max=1.0

			
		if dim=="linegraph":		#This is for the 1D graph case
			self.ax[0].set_xlabel(self.data[0].x_label+" ("+str(self.data[0].x_units)+")")
			self.ax[0].set_ylabel(self.data[0].data_label+" ("+self.data[0].data_units+")")

			for i in range(0,len(self.input_files)):
				cur_plot, = self.ax[i].plot(self.data[i].y_scale,self.data[i].data[0][0], linewidth=3 ,alpha=1.0,color=get_color(i),marker=get_marker(i))

				if self.labels[i]!="":
					files.append("$"+numbers_to_latex(str(self.labels[i]))+" "+pygtk_to_latex_subscript(self.data[0].key_units)+"$")

				all_plots.append(cur_plot)
				
				if len(self.data[i].labels)!=0:
					for ii in range(0,len(self.data[i].y_scale)):
						fx_unit=fx_with_units(float(self.data[i].labels[ii]))
						label_text=str(float(self.data[i].labels[ii])*fx_unit[0])+" "+fx_unit[1]
						self.ax[i].annotate(label_text,xy = (self.data[i].y_scale[ii], self.data[i].data[0][0][ii]), xytext = (-20, 20),textcoords = 'offset points', ha = 'right', va = 'bottom',bbox = dict(boxstyle = 'round,pad=0.5', fc = 'yellow', alpha = 0.5),arrowprops = dict(arrowstyle = '->', connectionstyle = 'arc3,rad=0'))
				#print(self.data[i].labels)
		elif dim=="wireframe":
			self.ax[0].set_xlabel(self.data[0].x_label+" ("+self.data[0].x_units+")")
			self.ax[0].set_ylabel(self.data[0].y_label+" ("+self.data[0].y_units+")")

			for i in range(0,len(self.input_files)):

				#new_data=[[float for y in range(self.data[0].y_len)] for x in range(self.data[0].x_len)]
				#for x in range(0,self.data[i].x_len):
				#	for y in range(0,self.data[i].y_len):
				#		print(x,y,len(self.data[i].data[0]),len(self.data[i].data[0][0]))
				#		new_data[x][y]=self.data[i].data[0][x][y]
				#z = 10 * outer(ones(size(data.x_scale)), cos(data.y_scale))
				#im=self.ax[0].plot_surface(data.x_scale,data.y_scale,z)
				#print(new_data)
				#print(self.data[i].x_scale)
				#print(self.data[i].y_scale)
				X, Y = meshgrid( self.data[i].y_scale,self.data[i].x_scale)
				Z = self.data[i].data[0]

				# Plot the surface
				im=self.ax[i].plot_wireframe( Y,X, Z)

				#pcolor
		elif dim=="heat":
			self.ax[0].set_xlabel(self.data[0].x_label+" ("+self.data[0].x_units+")")
			self.ax[0].set_ylabel(self.data[0].y_label+" ("+self.data[0].y_units+")")

			for i in range(0,len(self.input_files)):

				im=self.ax[0].pcolor(self.data[i].y_scale,self.data[i].x_scale,self.data[i].data[0])
				self.fig.colorbar(im)

				#pcolor

				#self.fig.colorbar(im, shrink=0.5, aspect=5)
				#self.ax[0].plot_surface(x, y, z, rstride=1, cstride=1, cmap=cm.coolwarm,linewidth=0, antialiased=False)
				#self.ax[0].invert_yaxis()
				#self.ax[0].xaxis.tick_top()
		elif dim=="3d":
			self.ax[0].set_xlabel(self.data[0].x_label+" ("+self.data[0].x_units+")")
			self.ax[0].set_ylabel(self.data[0].y_label+" ("+self.data[0].y_units+")")
			self.ax[0].set_zlabel(self.data[0].z_label+" ("+self.data[0].z_units+")")

			for ii in range(0,len(self.data[i].z_scale)):
				my_max,my_min=dat_file_max_min(self.data[i])
				X, Y = meshgrid( self.data[i].x_scale,self.data[i].y_scale)
				new_data=[[float for y in range(self.data[0].y_len)] for x in range(self.data[0].x_len)]
				for x in range(0,self.data[i].x_len):
					for y in range(0,self.data[i].y_len):
						new_data[x][y]=self.data[i].z_scale[ii]+self.data[i].data[ii][x][y]
				self.ax[i].contourf(X, Y, new_data, zdir='z')#

				self.ax[i].set_xlim3d(0, self.data[i].x_scale[-1])
				self.ax[i].set_ylim3d(0, self.data[i].y_scale[-1])
				self.ax[i].set_zlim3d(0, self.data[i].z_scale[-1])

		#setup the key
		if self.data[0].legend_pos=="No key":
			self.ax[i].legend_ = None
		else:
			if len(files)<40:
				self.fig.legend(all_plots, files, self.data[0].legend_pos)
			
		#self.fig.tight_layout(pad=0.0, w_pad=0.0, h_pad=0.0)
		self.fig.canvas.draw()
Beispiel #6
0
    def do_plot(self):
        if len(self.data) == 0:
            return

        if self.data[0].valid_data == False:
            return

        key_text = []

        self.plot_type = ""

        #print(self.data[0].x_len,self.data[0].z_len,self.data[0].data)
        if self.data[0].type == "rgb":
            self.plot_type = "rgb"
        elif self.data[0].type == "quiver":
            self.plot_type = "quiver"
        else:
            if self.data[0].x_len == 1 and self.data[0].z_len == 1:
                self.plot_type = "linegraph"
            elif self.data[0].x_len > 1 and self.data[
                    0].y_len > 1 and self.data[0].z_len == 1:
                if self.data[0].type == "3d":
                    self.plot_type = "wireframe"
                if self.data[0].type == "heat":
                    self.plot_type = "heat"
            elif self.data[0].x_len > 1 and self.data[
                    0].y_len > 1 and self.data[0].z_len > 1:
                print("ohhh full 3D")
                self.plot_type = "3d"
            else:
                print(_("I don't know how to process this type of file!"),
                      self.data[0].x_len, self.data[0].y_len,
                      self.data[0].z_len)
                return

        self.setup_axis()

        all_plots = []
        files = []
        my_max = 1.0

        if self.plot_type == "linegraph":  #This is for the 1D graph case
            self.ax[0].set_xlabel(self.data[0].y_label + " (" +
                                  str(self.data[0].y_units) + ")")
            self.ax[0].set_ylabel(self.data[0].data_label + " (" +
                                  self.data[0].data_units + ")")

            for i in range(0, len(self.data)):
                if self.data[0].logy == True:
                    self.ax[i].set_xscale("log")

                if self.data[0].logdata == True:
                    self.ax[i].set_yscale("log")

                if self.data[i].data_min != None:
                    self.ax[i].set_ylim(
                        [self.data[i].data_min, self.data[i].data_max])

                if self.data[i].rgb() != None:
                    col = "#" + self.data[i].rgb()
                else:
                    col = get_color(i)
                cur_plot, = self.ax[i].plot(self.data[i].y_scale,
                                            self.data[i].data[0][0],
                                            linewidth=3,
                                            alpha=1.0,
                                            color=col,
                                            marker=get_marker(i))
                #print(self.data[i].y_scale,self.data[i].data[0][0])
                if self.data[i].key_text != "":
                    key_text.append(
                        "$" + numbers_to_latex(str(self.data[i].key_text)) +
                        " " +
                        pygtk_to_latex_subscript(self.data[0].key_units) + "$")

                all_plots.append(cur_plot)

                if len(self.data[i].labels) != 0:
                    #we only want this many data labels or it gets crowded
                    max_points = 12
                    n_points = range(0, len(self.data[i].y_scale))
                    if len(n_points) > max_points:
                        step = int(len(n_points) / max_points)
                        n_points = []
                        pos = 0
                        while (len(n_points) < max_points):
                            n_points.append(pos)
                            pos = pos + step

                    for ii in n_points:
                        label_text = self.data[i].labels[ii]
                        self.ax[i].annotate(label_text,
                                            xy=(self.data[i].y_scale[ii],
                                                self.data[i].data[0][0][ii]),
                                            xytext=(-20, 20),
                                            textcoords='offset points',
                                            ha='right',
                                            va='bottom',
                                            bbox=dict(boxstyle='round,pad=0.5',
                                                      fc='yellow',
                                                      alpha=0.5),
                                            arrowprops=dict(
                                                arrowstyle='->',
                                                connectionstyle='arc3,rad=0'))

                #print(self.data[i].labels)
        elif self.plot_type == "wireframe":

            self.ax[0].set_xlabel('\n' + self.data[0].x_label + '\n (' +
                                  self.data[0].x_units + ")")
            self.ax[0].set_ylabel('\n' + self.data[0].y_label + '\n (' +
                                  self.data[0].y_units + ")")
            self.ax[0].set_zlabel('\n' + self.data[0].data_label + '\n (' +
                                  self.data[0].data_units + ")")

            self.log_3d_workaround()

            if self.force_data_max == False:
                my_max, my_min = dat_file_max_min(self.data[0])
                for i in range(0, len(self.data)):
                    my_max, my_min = dat_file_max_min(self.data[i],
                                                      cur_min=my_min,
                                                      cur_max=my_max)
            else:
                my_max = self.force_data_max
                my_min = self.force_data_min

            self.ax[0].set_zlim(my_min, my_max)

            for i in range(0, len(self.data)):

                if self.data[i].logx == True:
                    self.ax[i].set_xscale("log")

                if self.data[i].logy == True:
                    self.ax[i].set_yscale("log")

                #if self.data[i].key_text!="":
                key = "$" + numbers_to_latex(str(
                    self.data[i].key_text)) + " " + pygtk_to_latex_subscript(
                        self.data[0].key_units) + "$"

                X, Y = meshgrid(self.data[i].y_scale, self.data[i].x_scale)
                Z = self.data[i].data[0]

                # Plot the surface
                col = get_color(i)
                #print(self.data[i].plot_type,"here")
                if self.data[i].plot_type == "wireframe" or self.data[
                        i].plot_type == "":
                    im = self.ax[0].plot_wireframe(Y,
                                                   X,
                                                   array(Z),
                                                   color=col,
                                                   label=key,
                                                   clip_on=True)
                elif self.data[i].plot_type == "contour":
                    im = self.ax[0].contourf(Y, X, array(Z), color=col)
                elif self.data[i].plot_type == "heat":
                    my_max, my_min = dat_file_max_min(self.data[0])
                    im = self.ax[0].plot_surface(Y,
                                                 X,
                                                 array(Z),
                                                 linewidth=0,
                                                 vmin=my_min,
                                                 vmax=my_max,
                                                 cmap="hot",
                                                 antialiased=False)

                self.ax[0].legend()
                #im=self.ax[0].contourf( Y,X, Z,color=col)

#cset = ax.contourf(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm)
        elif self.plot_type == "heat":
            self.ax[0].set_xlabel(self.data[0].y_label + " (" +
                                  self.data[0].y_units + ")")
            self.ax[0].set_ylabel(self.data[0].x_label + " (" +
                                  self.data[0].x_units + ")")
            my_max, my_min = dat_file_max_min(self.data[0])
            for i in range(0, len(self.data)):
                if self.data[i].logdata == True:
                    if my_min == 0:
                        my_min = 1.0
                    im = self.ax[0].pcolor(self.data[i].y_scale,
                                           self.data[i].x_scale,
                                           self.data[i].data[0],
                                           norm=LogNorm(vmin=my_min,
                                                        vmax=my_max),
                                           vmin=my_min,
                                           vmax=my_max,
                                           cmap="gnuplot")
                else:
                    im = self.ax[0].pcolor(self.data[i].y_scale,
                                           self.data[i].x_scale,
                                           self.data[i].data[0],
                                           vmin=my_min,
                                           vmax=my_max,
                                           cmap="gnuplot")

                self.cb = self.fig.colorbar(im)

        elif self.plot_type == "3d":
            self.ax[0].set_xlabel(self.data[0].x_label + " (" +
                                  self.data[0].x_units + ")")
            self.ax[0].set_ylabel(self.data[0].y_label + " (" +
                                  self.data[0].y_units + ")")
            i = 0
            y_scale = self.data[i].y_scale
            x_scale = self.data[i].x_scale
            X, Y = meshgrid(
                y_scale, x_scale)  #self.data[i].y_scale,self.data[i].x_scale
            Z = self.data[i].data[0]
            col = get_color(i)
            my_max, my_min = dat_file_max_min(self.data[0])
        elif self.plot_type == "rgb":
            self.ax[0].set_xlabel(self.data[0].y_label + " (" +
                                  str(self.data[0].y_units) + ")")
            self.ax[0].set_ylabel(self.data[0].data_label + " (" +
                                  self.data[0].data_units + ")")
            self.ax[0].imshow(self.data[0].data[0])  #
            #,extent=[self.data[0].y_scale[0],self.data[0].y_scale[-1],0,20]
        elif self.plot_type == "quiver":
            self.ax[0].set_xlabel(self.data[0].x_label + " (" +
                                  self.data[0].x_units + ")")
            self.ax[0].set_ylabel(self.data[0].y_label + " (" +
                                  self.data[0].y_units + ")")
            self.ax[0].set_zlabel(self.data[0].z_label + " (" +
                                  self.data[0].z_units + ")")
            X = []
            Y = []
            Z = []
            U = []
            V = []
            W = []
            mag = []
            for d in self.data[0].data:
                X.append(d.x)
                Y.append(d.y)
                Z.append(d.z)
                U.append(d.dx)
                V.append(d.dy)
                W.append(d.dz)
                mag.append(d.mag)

            c = plt.cm.hsv(mag)

            mag = []
            for d in self.data[0].data:

                mag.append(2.0)

            self.ax[0].quiver(X, Y, Z, U, V, W, colors=c, linewidths=mag)
            self.ax[0].set_xlim([0, self.data[0].xmax])
            self.ax[0].set_ylim([0, self.data[0].ymax])
            self.ax[0].set_zlim([0, self.data[0].zmax])

        #setup the key
        if self.data[0].legend_pos == "No key":
            self.ax[i].legend_ = None
        else:
            if len(files) < 40:
                self.fig.legend(all_plots, key_text, self.data[0].legend_pos)

        if get_lock().is_trial() == True:
            x = 0.25
            y = 0.25
            #while(x<1.0):
            #	y=0
            #	while(y<1.0):
            self.fig.text(x,
                          y,
                          'gpvdm trial',
                          fontsize=20,
                          color='gray',
                          ha='right',
                          va='bottom',
                          alpha=self.watermark_alpha)

            #		y=y+0.1
            #	x=x+0.25

        if self.hide_title == False:
            title = self.data[0].title
            if self.data[0].time != -1.0 and self.data[0].Vexternal != -1.0:
                mul, unit = time_with_units(self.data[0].time)
                title = title + " V=" + str(
                    self.data[0].Vexternal) + " " + _("time") + "=" + str(
                        self.data[0].time * mul) + " " + unit

            self.fig.suptitle(title)

            self.setWindowTitle(title + " - www.gpvdm.com")

        self.fig.canvas.draw()