comparison sbpPlot.jl @ 124:631eb9b35d72 cell_based_test

Make grid spacing a property of EquidistantGrid. Create plotting module for sbplib.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Wed, 13 Feb 2019 10:37:52 +0100
parents
children d61bfc8cf6a5
comparison
equal deleted inserted replaced
122:6c6979ff17f4 124:631eb9b35d72
1 module sbpPlot
2 using PyPlot, PyCall
3
4 function plotgridfunction(grid::EquidistantGrid, gridfunction)
5 if dimension(grid) == 1
6 plot(pointsalongdim(grid,1), gridfunction, linewidth=2.0)
7 elseif dimension(grid) == 2
8 mx = grid.size[1]
9 my = grid.size[2]
10 X = repeat(pointsalongdim(grid,1),1,my)
11 Y = permutedims(repeat(pointsalongdim(grid,2),1,mx))
12 plot_surface(X,Y,reshape(gridfunction,mx,my));
13 else
14 error(string("Plot not implemented for dimension ", string(dimension(grid))))
15 end
16 end
17 end