Skip to content

Instantly share code, notes, and snippets.

@Hio-Been
Last active July 26, 2021 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hio-Been/1e6dd81f59ce1008bd87cdaa981efcc2 to your computer and use it in GitHub Desktop.
Save Hio-Been/1e6dd81f59ce1008bd87cdaa981efcc2 to your computer and use it in GitHub Desktop.
imagesc_surf: Handy MATLAB function for imagesc-like 2D visualization using surf.m
function handle = imagesc_surf( x, y, d )
size_xy = size( d );
if size(x,1)>size(x,2), x=x'; end
if size(y,1)>size(y,2), y=y'; end
if ~(size_xy(1)==length(x)), x = imresize(x, [1,size_xy(1)]); end
if ~(size_xy(2)==length(y)), y = imresize(y, [1,size_xy(2)]); end
handle = surf( x, y, d' ); axis xy
handle.LineStyle = 'none';
view(gca,[-0.001 90]);
set(gca, 'XScale', 'log', 'YScale', 'log');
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment