Пример #1
0
 def callback_autoscale_y(self):
     self.fix_scales = not self.fix_scales
     if self.fix_scales == True:
         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)
         self.force_data_max = my_max
         self.force_data_min = my_min
         self.do_plot()
     else:
         self.force_data_max = False
         self.force_data_min = False
Пример #2
0
    def log_3d_workaround(self):
        if self.done_log == False:
            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:
                    my_max, my_min = dat_file_max_min(self.data[i],
                                                      cur_min=my_min,
                                                      cur_max=my_max)

            zticks = []
            zticks_txt = []
            pos = pow(10, floor(log10(abs(my_min))))

            if my_min > 0:
                while (pos < my_max):
                    pos = pos * 10
                    zticks.append(pos)
                    zticks_txt.append("{:.0e}".format(pos))

            if (len(zticks) > 5):
                delta = int(len(zticks) / 5)
                pos = 0
                rebuild = []
                rebuild_txt = []
                while (pos < len(zticks)):
                    rebuild.append(zticks[pos])
                    rebuild_txt.append(zticks_txt[pos])
                    pos = pos + delta
                zticks = rebuild
                zticks_txt = rebuild_txt

            changed = False
            for i in range(0, len(self.data)):
                if self.data[i].y_len > 1 and self.data[
                        i].x_len > 1 and self.data[i].logdata == True:
                    changed = True
                    for x in range(0, self.data[i].x_len):
                        for y in range(0, self.data[i].y_len):
                            for z in range(0, self.data[i].z_len):
                                if self.data[i].data[z][x][y] != 0:
                                    self.data[i].data[z][x][y] = log10(
                                        abs(self.data[i].data[z][x][y]))

            if changed == True and self.fix_scales == False:
                self.ax[0].set_zticks(log10(zticks))
                self.ax[0].set_zticklabels(zticks_txt)
        self.done_log = True
Пример #3
0
	def menu_plot_open(self):
		from gpvdm_open import gpvdm_open
		dialog=gpvdm_open(get_sim_path(),show_inp_files=False,act_as_browser=False)
		ret=dialog.exec_()
		if ret==QDialog.Accepted:
			self.graph_path=dialog.get_filename()
			if self.graph_data.load(self.graph_path)==True:
				#print(self.graph_path)
				self.graph_data.data_max,self.graph_data.data_min=dat_file_max_min(self.graph_data)
Пример #4
0
		def load_data(self):
			lines=[]

			if dat_file_read(self.graph_data,self.graph_path)==True:
				#print(self.graph_path)
				self.graph_z_max,self.graph_z_min=dat_file_max_min(self.graph_data)
				#print(self.graph_z_max,self.graph_z_min)
			val=inp_get_token_value(os.path.join(get_sim_path(),"light.inp"), "#Psun")
			try:
				self.suns=float(val)
			except:
				self.suns=0.0
Пример #5
0
    def norm_data(self):
        if len(self.data) > 0:
            if self.data[0].type == "rgb" or self.data[0].type == "quiver":
                return

            if self.zero_frame_enable == True:
                if len(self.data) > 1:
                    for i in range(1, len(self.data)):
                        dat_file_sub(self.data[i], self.data[0])

                    dat_file_sub(self.data[0], self.data[0])
            for i in range(0, len(self.data)):
                for x in range(0, self.data[i].x_len):
                    self.data[i].x_scale[
                        x] = self.data[i].x_scale[x] * self.data[i].x_mul

                for y in range(0, self.data[i].y_len):
                    self.data[i].y_scale[
                        y] = self.data[i].y_scale[y] * self.data[i].y_mul

                for z in range(0, self.data[i].z_len):
                    self.data[i].z_scale[
                        z] = self.data[i].z_scale[z] * self.data[i].z_mul

                for x in range(0, self.data[i].x_len):
                    for y in range(0, self.data[i].y_len):
                        for z in range(0, self.data[i].z_len):
                            self.data[i].data[z][x][y] = self.data[i].data[z][
                                x][y] * self.data[i].data_mul

            if self.data[0].invert_y == True:
                for i in range(0, len(self.data)):
                    dat_file_mul(self.data[i], -1)

            if self.data[0].subtract_first_point == True:
                val = self.data[0].data[0][0][0]
                for i in range(0, len(self.data)):
                    dat_file_sub_float(self.data[i], val)

            if self.data[0].add_min == True:
                my_max, my_min = dat_file_max_min(self.data[0])
                for i in range(0, len(self.data)):
                    dat_file_sub_float(self.data[i], my_min)
Пример #6
0
	def cal_min_max(self):

		self.z_max=-1e40
		self.z_min=1e40

		for i in range(0,len(self.dirs)):
			fname=os.path.join(self.dirs[i],self.files_combo.currentText())
			x=[]
			y=[]
			z=[]

			my_data=dat_file()
			if dat_file_read(my_data,fname) == True:
				#print(z)
				temp_max,temp_min=dat_file_max_min(my_data)

				if temp_max>self.z_max:
					self.z_max=temp_max

				if temp_min<self.z_min:
					self.z_min=temp_min
Пример #7
0
    def draw_graph(self):
        z = 0
        #for z in range(0,len(self.graph_data.z_scale)):
        my_max, my_min = dat_file_max_min(self.graph_data)

        if len(self.graph_data.z_scale) == 1:
            zi_list = [0]
        else:
            zi_list = [0, len(self.graph_data.z_scale) - 1]

        glBegin(GL_QUADS)

        if len(self.graph_data.z_scale) > 1:
            dz = self.graph_data.z_scale[1] - self.graph_data.z_scale[0]
        else:
            dz = 0.0

        dx = self.graph_data.x_scale[1] - self.graph_data.x_scale[0]
        dy = self.graph_data.y_scale[1] - self.graph_data.y_scale[0]

        #front,back
        for zi in zi_list:
            for xi in range(0, len(self.graph_data.x_scale)):
                for yi in range(0, len(self.graph_data.y_scale)):
                    x0 = gl_scale.project_m2screen_x(
                        self.graph_data.x_scale[xi])
                    y0 = gl_scale.project_m2screen_y(
                        self.graph_data.y_scale[yi])
                    z0 = gl_scale.project_m2screen_z(
                        self.graph_data.z_scale[zi])
                    x1 = gl_scale.project_m2screen_x(
                        self.graph_data.x_scale[xi] + dx)
                    y1 = gl_scale.project_m2screen_y(
                        self.graph_data.y_scale[yi] + dy)
                    z1 = gl_scale.project_m2screen_z(
                        self.graph_data.z_scale[zi])
                    if self.graph_data.data[zi][xi][yi] != 0.0:
                        r, g, b = val_to_rgb(self.graph_data.data[zi][xi][yi] /
                                             (my_max - my_min))

                        #glColor4f(r,g,b, 1.0)
                        col = [r, g, b, 1.0]
                        glMaterialfv(GL_FRONT, GL_DIFFUSE, col)

                        glVertex3f(x0, y0, z0)
                        glVertex3f(x1, y0, z0)
                        glVertex3f(x1, y1, z0)
                        glVertex3f(x0, y1, z0)

        if len(self.graph_data.z_scale) == 1:
            glEnd()
            return

        #left,right
        for xi in [0, len(self.graph_data.x_scale) - 1]:
            for zi in range(0, len(self.graph_data.z_scale)):
                for yi in range(0, len(self.graph_data.y_scale)):
                    x0 = gl_scale.project_m2screen_x(
                        self.graph_data.x_scale[xi])
                    y0 = gl_scale.project_m2screen_y(
                        self.graph_data.y_scale[yi])
                    z0 = gl_scale.project_m2screen_z(
                        self.graph_data.z_scale[zi])
                    x1 = gl_scale.project_m2screen_x(
                        self.graph_data.x_scale[xi])
                    y1 = gl_scale.project_m2screen_y(
                        self.graph_data.y_scale[yi] + dy)
                    z1 = gl_scale.project_m2screen_z(
                        self.graph_data.z_scale[zi] + dz)
                    r, g, b = val_to_rgb(self.graph_data.data[zi][xi][yi] /
                                         (my_max - my_min))

                    #glColor4f(r,g,b, 1.0)
                    col = [r, g, b, 1.0]
                    glMaterialfv(GL_FRONT, GL_DIFFUSE, col)

                    glVertex3f(x0, y0, z0)
                    glVertex3f(x0, y1, z0)
                    glVertex3f(x0, y1, z1)
                    glVertex3f(x0, y0, z1)

        #top,bottom
        for yi in [0, len(self.graph_data.y_scale) - 1]:
            for zi in range(0, len(self.graph_data.z_scale)):
                for xi in range(0, len(self.graph_data.x_scale)):
                    x0 = gl_scale.project_m2screen_x(
                        self.graph_data.x_scale[xi])
                    y0 = gl_scale.project_m2screen_y(
                        self.graph_data.y_scale[yi])
                    z0 = gl_scale.project_m2screen_z(
                        self.graph_data.z_scale[zi])
                    x1 = gl_scale.project_m2screen_x(
                        self.graph_data.x_scale[xi] + dx)
                    y1 = gl_scale.project_m2screen_y(
                        self.graph_data.y_scale[yi])
                    z1 = gl_scale.project_m2screen_z(
                        self.graph_data.z_scale[zi] + dz)

                    r, g, b = val_to_rgb(
                        (self.graph_data.data[zi][xi][yi] - my_min) /
                        (my_max - my_min))

                    #glColor4f(r,g,b, 1.0)
                    col = [r, g, b, 1.0]
                    glMaterialfv(GL_FRONT, GL_DIFFUSE, col)

                    glVertex3f(x0, y0, z0)
                    glVertex3f(x1, y0, z0)
                    glVertex3f(x1, y0, z1)
                    glVertex3f(x0, y0, z1)

        glEnd()
Пример #8
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()
Пример #9
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()