예제 #1
0
class MainView(ZApplicationView):
  # Constructor
  def __init__(self, title, x, y, width, height):
    super(MainView, self).__init__(title, x, y, width, height)
    
    self.plotter = ZScrolledPlottingArea(self, 1200, 500)
    
    self.ax1= self.plotter.add(131)
    self.ax1.hist(rand(100), bins=20, color='k', alpha=0.3)
    
    self.ax2= self.plotter.add(132)
    self.ax2.scatter(np.arange(30), np.arange(30) + 3 * rand(30))

    self.ax3 = self.plotter.add(133)
    
    sns.set()
    uniform_data = np.random.rand(100, 100)
    sns.heatmap(uniform_data, ax = self.ax3)

    self.add(self.plotter)
    
    self.show()

  def file_save(self):
    try:
      abs_current_path = os.path.abspath(os.path.curdir)
      files_types = "PDF (*.pdf);;PGF (*.pgf);;PNG (*.png);;PS (*.ps);;EPS (*.eps);;RAW (*.raw);;RGBA (*.rgba);;SVG (*.svg);;SVGZ (*.svgz)"
      filename, _ = QFileDialog.getSaveFileName(self, "FileSaveDialog", 
                             os.path.join(abs_current_path, "figure.png"),
                             files_types)
      if filename:
        plt.savefig(filename) 
    except:
      traceback.print_exc()
예제 #2
0
  def __init__(self, title, x, y, width, height):
    super(MainView, self).__init__(title, x, y, width, height)
    
    self.plotter = ZScrolledPlottingArea(self, 800, 600)
  
    self.ax= self.plotter.add(111)

    sns.set()
    dataset3 = pd.read_csv("http://pythondatascience.plavox.info/wp-content/uploads/2016/05/sample_dataset.csv")
    dataset3 = dataset3.pivot("Sex", "Occupation", "Salary")
    sns.heatmap(dataset3, cmap="jet", ax = self.ax)

    self.add(self.plotter)
    
    self.show()
예제 #3
0
    def __init__(self, title, x, y, width, height):
        super(MainView, self).__init__(title, x, y, width, height)

        self.plotter = ZScrolledPlottingArea(self, 1200, 1200)
        self.minist = keras.datasets.mnist

        (self.X_train,
         self.y_train), (self.X_test_,
                         self.y_test) = keras.datasets.mnist.load_data()

        self.class_names = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

        for i in range(25):
            plt.subplot(5, 5, i + 1)
            plt.xticks([])
            plt.yticks([])
            plt.grid(False)
            plt.imshow(self.X_train[i],
                       cmap=plt.cm.gray_r,
                       interpolation="nearest")
            plt.xlabel(self.class_names[self.y_train[i]])

        self.add(self.plotter)

        self.show()
예제 #4
0
class MainView(ZApplicationView):
  def __init__(self, title, x, y, width, height):
    super(MainView, self).__init__(title, x, y, width, height)
    
    self.plotter = ZScrolledPlottingArea(self, 800, 600)
  
    self.ax= self.plotter.add(111)

    sns.set()
    dataset3 = pd.read_csv("http://pythondatascience.plavox.info/wp-content/uploads/2016/05/sample_dataset.csv")
    dataset3 = dataset3.pivot("Sex", "Occupation", "Salary")
    sns.heatmap(dataset3, cmap="jet", ax = self.ax)

    self.add(self.plotter)
    
    self.show()

  def file_save(self):
    try:
      abs_current_path = os.path.abspath(os.path.curdir)
      files_types = "All Files (*);;Image Files (*.png;*jpg;*.jpeg)"
      filename, _ = QFileDialog.getSaveFileName(self, "FileSaveDialog", 
                             os.path.join(abs_current_path, "image.png"),
                             file_types)
      if filename:
        self.image_view.file_save(filename)
         
    except:
      traceback.print_exc()
예제 #5
0
class MainView(ZApplicationView):
  def __init__(self, title, x, y, width, height):
    super(MainView, self).__init__(title, x, y, width, height)
    
    self.plotter = ZScrolledPlottingArea(self, 800, 600)
  
    self.ax= self.plotter.add(111)

    sns.set()
    flights = sns.load_dataset("flights")
 
    flights = flights.pivot("month", "year", "passengers")
 
    sns.heatmap(flights, annot=True, fmt="d", ax = self.ax)
    
    self.add(self.plotter)
    
    self.show()

  def file_save(self):
    try:
      abs_current_path = os.path.abspath(os.path.curdir)
      files_types = "PDF (*.pdf);;PGF (*.pgf);;PNG (*.png);;PS (*.ps);;EPS (*.eps);;RAW (*.raw);;RGBA (*.rgba);;SVG (*.svg);;SVGZ (*.svgz)"
      filename, _ = QFileDialog.getSaveFileName(self, "FileSaveDialog", 
                             os.path.join(abs_current_path, "figure.png"),
                             files_types)
      if filename:
        plt.savefig(filename) 
    except:
      traceback.print_exc()
예제 #6
0
  def __init__(self, title, x, y, width, height):
    super(MainView, self).__init__(title, x, y, width, height)
    
    self.plotter = ZScrolledPlottingArea(self, 800, 600)
  
    self.ax= self.plotter.add(111)

    sns.set()
    flights = sns.load_dataset("flights")
 
    flights = flights.pivot("month", "year", "passengers")
 
    sns.heatmap(flights, annot=True, fmt="d", ax = self.ax)
    
    self.add(self.plotter)
    
    self.show()
예제 #7
0
  def __init__(self, title, x, y, width, height):
    super(MainView, self).__init__(title, x, y, width, height)
    
    self.plotter = ZScrolledPlottingArea(self, 1200, 500)
    
    self.ax1= self.plotter.add(131)
    self.ax1.hist(rand(100), bins=20, color='k', alpha=0.3)
    
    self.ax2= self.plotter.add(132)
    self.ax2.scatter(np.arange(30), np.arange(30) + 3 * rand(30))

    self.ax3 = self.plotter.add(133)
    
    sns.set()
    uniform_data = np.random.rand(100, 100)
    sns.heatmap(uniform_data, ax = self.ax3)

    self.add(self.plotter)
    
    self.show()
예제 #8
0
    def __init__(self, title, x, y, width, height):
        super(MainView, self).__init__(title, x, y, width, height)

        # Load iris data
        iris = sns.load_dataset("iris")

        sns.set()
        sns.swarmplot(x="species", y="petal_length", data=iris)

        self.plotter = ZScrolledPlottingArea(self, 800, 600, plt.gcf())

        self.add(self.plotter)

        self.show()
  def __init__(self, title, x, y, width, height):
    super(MainView, self).__init__(title, x, y, width, height)
    
    self.plotter = ZScrolledPlottingArea(self, 1200, 1200)
    self.fashion_mnist = keras.datasets.fashion_mnist


    (self.X_train, self.y_train), (self.X_test_, self.y_test) = keras.datasets.fashion_mnist.load_data()

    self.class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 
               'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot']

    for i in range(100):
      plt.subplot(10, 10, i+1)
      plt.xticks([])
      plt.yticks([])
      plt.grid(False)
      plt.imshow(self.X_train[i],  cmap=plt.cm.gray_r, interpolation="nearest")
      plt.xlabel(self.class_names[self.y_train[i]])
      
    self.add(self.plotter)
    
    self.show()