Effacer les filtres
Effacer les filtres

plot_google_map resizing after contourf plot with hold on;

3 vues (au cours des 30 derniers jours)
Jon Rendulic
Jon Rendulic le 6 Avr 2016
So I need to plot my contourf plot on top of a google map satellite image. What is happening is my google map is resizing itself and/or either plotting over or removing my contour plot.
Breaking down my code into sections it works like this:
using this code my contourf plot looks like this.
% figure(45)
load('/Users/laptop/Desktop/LCS_TEST/Mat_Files/Z_T1.mat');
h1 = figure(11);
set(h1, 'Visible', 'on');
Z = sigma0';
z1=min(min(Z)); z2=max(max(Z));
color_range = z1:((z2-z1)/11):z2;
Contours=10.^color_range;
contourf(xmesh,ymesh,Z,color_range); %,color_range
h=contourcmap('jet',...
'Location', 'vertical', ...
'TitleString', 'deposition');
%caxis([z1,z2]);
g=colorbar('YTick',color_range,'YTickLabel',Contours);
title(g,'deposition(grains/m2)')
xlabel('longitude');ylabel('latitude');
and the output looks like this:
using the following code a plot using the plot_google_map.m function looks like the following:
figure(22)
lat = [55 60];
lon = [-160 -150];
plot(lon,lat,'.r','MarkerSize',20)
plot_google_map
And the plot looks like this:
Now combining the code my google map resizes itself. I also read people had similar problems so it was recommended I save the file as a png and pdf but that does not work either.
See my latest code:
% figure(45)
load('/Users/mb00k/Desktop/LCS_TEST/Mat_Files/Z_T1.mat');
h1 = figure();
set(h1, 'Visible', 'off');
Z = sigma0';
z1=min(min(Z)); z2=max(max(Z));
color_range = z1:((z2-z1)/11):z2;
Contours=10.^color_range;
contourf(xmesh,ymesh,Z,color_range); %,color_range
h=contourcmap('jet',...
'Location', 'vertical', ...
'TitleString', 'deposition');
%caxis([z1,z2]);
g=colorbar('YTick',color_range,'YTickLabel',Contours);
title(g,'deposition(grains/m2)')
xlabel('longitude');ylabel('latitude');
hold on;
lat = [55 60];
lon = [-160 -150];
plot(lon,lat,'k.','MarkerSize',20);
% plot the google map on the background of the current figure
plot_google_map('maptype','hybrid','APIKey','keyzzzzzzzzzzzz');
% % Output the contours into pdf and png file
fileextension = '.pdf';
name = ['/Users/laptop/Desktop/LCS_TEST/','test',fileextension];
print('-dpdf',name);
fileextension = '.png';
name=['/Users/laptop/Desktop/LCS_TEST/', 'test',fileextension];
print('-dpng',name);
delete(h);
output looks like this:
Any ideas why this is happening?
Any help would be greatly appreciated.

Réponses (0)

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by