changeset 53:8c6db1f6d8e0

Save plot to file when calling plotgridfunction, until figuring out how to set up an interactive gui backend for matplotlib in julia.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Mon, 14 Jan 2019 11:30:36 +0100
parents 0236f8e90567
children 4300a3fbd818 f3ea15c8ebb6
files EquidistantGrid.jl
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/EquidistantGrid.jl	Fri Jan 11 11:55:48 2019 +0100
+++ b/EquidistantGrid.jl	Mon Jan 14 11:30:36 2019 +0100
@@ -96,7 +96,8 @@
 end
 
 using PyPlot, PyCall
-# using Plots; pyplot()
+#pygui(:qt)
+#using Plots; pyplot()
 
 function plotgridfunction(grid::EquidistantGrid, gridfunction)
     if numberOfDimensions(grid) == 1
@@ -107,13 +108,13 @@
         x = pointsalongdim(grid,1)
         X = repeat(x,1,my)
         y = pointsalongdim(grid,2)
-        Y = repeat(y,1,mx)
-        # plot_surface(X,Y,reshape(gridfunction,mx,my))
-        fig = figure()
-        ax = fig[:add_subplot](1,1,1, projection = "3d")
-        ax[:plot_surface](X,Y,reshape(gridfunction,mx,my))
-        plt[:show]()
+        Y = permutedims(repeat(y,1,mx))
+        plot_surface(X,Y,reshape(gridfunction,mx,my))
+        # fig = figure()
+        # ax = fig[:add_subplot](1,1,1, projection = "3d")
+        # ax[:plot_surface](X,Y,reshape(gridfunction,mx,my))
     else
         error(string("Plot not implemented for dimension ", string(numberOfDimensions(grid))))
     end
+    savefig("gridfunction")
 end