Creating movies from surface maps

How can I create movies from figures produced with "surfacem" of the Maping Toolbox?
Thank you.

Answers (2)

Image Analyst
Image Analyst on 13 Dec 2011

6 Comments

Dear Image Analyst,
thank you very much for your answer. However, the question was not about how to create movies in general, which I can do without problem. The question was about how to create movies from images produced using "surfacem" of the Mapping Toolbox. I either end up with a movie with a white rectangular background containing an extra x-y axis and my movie is superposed on that set of axes; other problems: if my surface map is large, the movie only shows a small section of the map, etc.
It appears that I need to do something extra to create the movies if the figures are from the Mapping Toolbox.
Once again, thank you for all your help.
Best regards,
Jorge
Since the suggested approaches both save the figure as an image at each frame, the problem must therefore be that your figure to image conversion is introducing the errors you describe. Perhaps you can improve your question to be more specific about this.
Dear Oliver,
below is a snippet of my code for your review. Again, thank you.
Jorge
scrsz = get(0,'ScreenSize');
states = shaperead('usastatehi', 'UseGeoCoords', true);
figure('Name','Vulnerability Analysis','Position',[scrsz(1) 0 scrsz(3) scrsz(4)]);
axesm ('eqaconic','MapLatLimit',[15 55],'MapLonLimit',[-130 -60]);
worldmap([24 51],[-126 -66]);
geoshow(states,'FaceColor',[1,1,1]);
geoshow('worldrivers.shp', 'Color', 'blue');
framem off
gridm on
caxis([0 1]);
h = gcf; surfacem(latitude,longitude,Vul_P,'CDataMapping','scaled');
xlabel('Longitude');ylabel('Latitude');
title({'Distribution Approach'});
colormap(mycolormap_3);
colorbar('location','EastOutside');
Md(i) = getframe(h);
hold on;
Have you tried using frame2im?
What are sample lat/lon/Vul_P values we could use to replicate what you have?
A sample dataset and simple code reproducing my problem can be downloaded from:
http://www.engr.colostate.edu/~ramirez/MovieQuestion.zip
Thank you.

Sign in to comment.

  • Force the figure to be a certain size with units pixels, put a set of axes onto it in a certain position. Then use the rectangle second input to getframe to extract just the part you want. (You could also just guess and check a few times to figure out the part you want.
  • To play the movie, set the various axes ticks to off so they don't show up, i.e:
figure;
axes;
set(gca,'xtick',[]);
set(gca,'ytick',[]);
movie(Md,5);

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Products

Asked:

on 13 Dec 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!