function plot_profile, x, y, z, xname, yname, plot_title, file_name, z_max ;---------- ;Help ;---------- ;Function for plotting a contour plot map of 3D data and writing the result to .PNG file. ;---------- ;Variable preparation ;---------- x = double(x) y = double(y) z = double(z) xname = string(xname) yname = string(yname) plot_title = string(plot_title) file_name = string(file_name) z_max = double(z_max) n_level = 20L level_vec = dindgen(n_level)/double(n_level)*2d*z_max -z_max clabel_vec = dblarr(n_elements(level_vec)) for i=1,10 do begin clabel_vec[i*2-1] = 1d endfor clabel_vec[0] = 1d ;---------- ;Plotting and exporting to PNG ;---------- set_plot, 'z' device, set_pixel_depth = 24, decomposed = 0, z_buffering = 0 loadct,39 !P.color=0 !P.background=255 contour, z, x, y, levels = level_vec, xrange = [min(x), max(x)], yrange = [min(y),max(y)], xstyle = 1, ystyle = 1, xtitle = xname, ytitle = yname, title = plot_title, /fill contour, z, x, y, levels = level_vec, xrange = [min(x), max(x)], yrange = [min(y),max(y)], xstyle = 1, ystyle = 1, xtitle = xname, ytitle = yname, title = plot_title, c_labels=clabel_vec, /overplot write_png, file_name+'.png', tvrd(true=1) device, /close ;---------- ;Finalisation ;---------- end