Mercurial > repos > public > sbplib_julia
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sbpPlot.jl Wed Feb 13 10:37:52 2019 +0100 @@ -0,0 +1,17 @@ +module sbpPlot +using PyPlot, PyCall + +function plotgridfunction(grid::EquidistantGrid, gridfunction) + if dimension(grid) == 1 + plot(pointsalongdim(grid,1), gridfunction, linewidth=2.0) + elseif dimension(grid) == 2 + mx = grid.size[1] + my = grid.size[2] + X = repeat(pointsalongdim(grid,1),1,my) + Y = permutedims(repeat(pointsalongdim(grid,2),1,mx)) + plot_surface(X,Y,reshape(gridfunction,mx,my)); + else + error(string("Plot not implemented for dimension ", string(dimension(grid)))) + end +end +end