2016-04-04 11 views
2

Dosya görüntüsünde this submission kullanarak aynı görüntüye iki renk çubuğu yerleştiriyorum. İlki daha uzun olmasının nedeni bilen var mıcolorbar eastoutside vs westoutside

colorbar('EastOutside') 

:

colorbar('WestOutside') 

tarafından ikincisi konumu:

enter image description here

ilk Colorbar pozisyonu

tarafından ayarlanır ?

Matlab documentation'a baktığımda, bunların aynı olması gerektiğini düşündüm. Neyi kaçırıyorum?

%define coordinates of the nodes 
theta=linspace(0,2*pi,33); 
[x,y]=pol2cart(theta,1); 

%define colormap of the links 
cm = winter; 
colormap(cm); 

%plot the links 
for ii=1:N 
quiver(...) 
end 

%place the first colorbar 
hcb=colorbar('EastOutside'); 

%freeze the first colorbar 
cbfreeze(hcb); 


%define the second colormap 
cm = autumn; 
colormap(cm); 

%plot the dots 
for ii=1:N 
plot(...) 
end 

%place the second colorbar 
hb=colorbar('EastOutside'); 
+0

Grafik resminizi nasıl oluşturduğunuzu gösteren biraz daha kod yazmanızı öneririm – Dan

+0

Nice plot! Önce ekseni oluşturmayı deneyeceğim, sonra bu ekseni açıkça belirten colorbar'larınızı ekleyin, daha sonra ekseni açıkça belirten grafiklerinizi de yapın. İlk renk eşleminin eksen dolduktan önce oluşturulduğu anlaşılıyor, bu nedenle grafikleriniz tarafından yeniden boyutlandırılabilir. –

+0

@HughNolan teşekkürler, ama nasıl yapacağımı bilmiyorum. İlk önce ekseni nasıl oluşturabilirim ve arsa nasıl yapabilirim? – shamalaia

cevap

1

anahtar iki farklı eksenleri kullanmaktır:

kod iskelet şudur. Bu yaratır

%define coordinates of the nodes 
theta=linspace(0,2*pi,33); 
[x,y]=pol2cart(theta,1); 

%plot the links 
close 
figure; 
for ii=1:100 
    quiver(x,y) 
end 
%define colormap of the links 
ax1 = gca; 
colormap (ax1,winter) 
%place the first colorbar 
hcb=colorbar(ax1,'EastOutside'); 
%this is tentative, just to get the axes right position: 
hb=colorbar(ax1,'WestOutside'); 
pos = ax1.Position; 
hb.delete 
% second colorbar 
ax2 = axes; 
colormap (ax2,autumn) 
hb=colorbar(ax2,'WestOutside'); 
ax2.Position = pos; 
axis off 
ax1.Position = pos; 

: enter image description here

MATLAB 2015a kullanma koduna dayanarak.