Setting specific colorbar limits using coneplot
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
My purpose is to produce 2d plots of vector winds with the vectors size and colour representing the strength of the vector. I've got fairly far with it. Currently I am using coneplot and have the below image with vector winds plotted as cones with colour and size representing the vector.
My issue is that I want multiple plots to represent winds the same i.e. equal strength winds represented by the same colour and size cone across all plots. I use subplot with the below code to plot the 4 plots. I want to now normalise these plots so that the size and winds across all plots are the same. Notice how in the plot all the colorbar scales are different. Any ideas how to do this?
Here is my code below:
% Vector field
[X Y Z] = meshgrid(0:11,0:31,[0 1]);
W = zeros(size(X)); % the third dim, unused here
% We do not want anything for Z=1
figure(100)
subplot(1,4,1)
U(:,:,1) = bias_U_amps_land_day(1:32,:);
V(:,:,1) = bias_V_amps_land_day(1:32,:);
U(:,:,2) = 0;V(:,:,2)=0;
coneplot(X,Y,Z,U,V,W,X,Y,Z,sqrt(U.^2+V.^2),1.5)
% view(2)
shading interp
colorbar
ylim([-1 32])
xlim([-1 11])
axis equal
set(gca,'FontSize',fonts,'FontName',fontn)
t = title('Land/Day');
set(t,'FontSize',fonts,'FontName',fontn)
y = ylabel('Model Level');
set(y,'FontSize',fonts,'FontName',fontn)
h = xlabel('Leadtime');
set(h,'FontSize',fonts,'FontName',fontn)
ylim([-1 32])
figure(100)
subplot(1,4,2)
U(:,:,1) = bias_U_amps_land_night(1:32,:);
V(:,:,1) = bias_V_amps_land_night(1:32,:);
U(:,:,2) = 0;V(:,:,2)=0;
coneplot(X,Y,Z,U,V,W,X,Y,Z,sqrt(U.^2+V.^2),1.5)
% view(2)
shading interp
colorbar
ylim([-1 32])
xlim([-1 11])
axis equal
set(gca,'FontSize',fonts,'FontName',fontn)
t = title('Land/Night');
set(t,'FontSize',fonts,'FontName',fontn)
h = xlabel('Leadtime');
set(h,'FontSize',fonts,'FontName',fontn)
ylim([-1 32])
figure(100)
subplot(1,4,3)
U(:,:,1) = bias_U_amps_ocean_day(1:32,:);
V(:,:,1) = bias_V_amps_ocean_day(1:32,:);
U(:,:,2) = 0;V(:,:,2)=0;
coneplot(X,Y,Z,U,V,W,X,Y,Z,sqrt(U.^2+V.^2),1.5);
% view(2)
shading interp
colorbar
ylim([-1 32])
xlim([-1 11])
axis equal
set(gca,'FontSize',fonts,'FontName',fontn)
t = title('Ocean/Day');
set(t,'FontSize',fonts,'FontName',fontn)
h = xlabel('Leadtime');
set(h,'FontSize',fonts,'FontName',fontn)
ylim([-1 32])
figure(100)
subplot(1,4,4)
U(:,:,1) = bias_U_amps_ocean_night(1:32,:);
V(:,:,1) = bias_V_amps_ocean_night(1:32,:);
U(:,:,2) = 0;V(:,:,2)=0;
c = coneplot(X,Y,Z,U,V,W,X,Y,Z,sqrt(U.^2+V.^2),1.5);
% view(2)
shading interp
colorbar
ylim([-1 32])
xlim([-1 11])
axis equal
set(gca,'FontSize',fonts,'FontName',fontn)
t = title('Ocean/Night');
set(t,'FontSize',fonts,'FontName',fontn)
h = xlabel('Leadtime');
set(h,'FontSize',fonts,'FontName',fontn)
ylim([-1 32])
0 commentaires
Réponse acceptée
Kelly Kearney
le 7 Avr 2014
You need to set the clim value of all your axes to be the same. It'll be easiest if you save the handles to your axes:
h(1) = subplot(1,4,1);
h(2) = subplot(1,4,2); % etc
set(h, 'clim', [0 3.5]);
3 commentaires
Kelly Kearney
le 8 Avr 2014
Based on the docs, it looks like perhaps setting S to 0 would do that? Otherwise, the values are scaled based on the max u/v/z values in each plot.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Vector Fields 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!