필터 지우기
필터 지우기

Define properties of colorbar

조회 수: 2 (최근 30일)
yogan sganzerla
yogan sganzerla 2018년 7월 1일
댓글: jonas 2018년 8월 6일
Hello, I am trying to configure a colorbar but there are two information that I don't know how to do.
This is the image of my plot
In addition, I am adding the code below:
function [ ] = Figure1(TT,aux,x,y)
set(gcf,'Color',[1 1 1]);
h=colorbar('SouthOutside');
set(h, 'Position', [.05 .15 .9 .05]);
load('MyColormap.mat')
if aux == 1
subplot('Position',[.0 .25 .20 .20]);
elseif aux == 2
subplot('Position',[.25 .25 .20 .20]);
elseif aux == 3
subplot('Position',[.5 .25 .20 .20]);
else
subplot('Position',[.75 .25 .20 .20]);
end
shading flat
pcolor(x,y,TT')
colormap(mymap)
caxis([275 320])
shading interp
view(2)
axis square
set(gca,'Visible','off')
end
What I need:
  1. Define (reduce) the space between subplot(1,4,1) e subplot(1,4,2) .....
  2. Add a title on my horizontal colorbar.
PS: I have already read many links, but I couldn't find a concrete information!
Cheers
  댓글 수: 12
yogan sganzerla
yogan sganzerla 2018년 7월 5일
Mr Jonas, As I said before, I have already studied this function and I am studying again but it doesn't work with me!!
Could you give a complete example that the answer is a plot with 1 row and 4 columns with the circle closer than the default?
I create a vector with the position to plot the 4 circle. The image I am adding below.
And ha(1) = [0.0400 0.0300 0.2075 0.9400] ha(2) = [0.2775 0.0300 0.2075 0.9400] ha(3) = [0.5150 0.0300 0.2075 0.9400] ha(4) = [0.7525 0.0300 0.2075 0.9400]
How can I integrate the subplot(1,4,1) with ha(1)?
jonas
jonas 2018년 7월 5일
I don't know what it means to integrate subplot(1,4,1) with ha(1). See my answer below.

댓글을 달려면 로그인하십시오.

채택된 답변

jonas
jonas 2018년 7월 5일
편집: jonas 2018년 7월 5일
I'm just gonna sum up the comment chain as an answer for future reference.
Walter Robinson gave an excellent solution for dealing with axis placement without use of third-party functions (see question comments). The following example makes use of the FileExchange function tight_subplot ( link ). Similar functions are subtightplot ( link ) and subplot_tight ( link ). Syntax may differ depending on function.
%%Create 4 axes with zero gap and zero margins
ha=tight_subplot(1,4,0,0,0);
%%Plot 4 circles with zero space in between and remove any axis graphics
for i=1:4
axes(ha(i));
viscircles([0 0],1);
axis square
axis tight
set(gca,'color','none','xcolor','none','ycolor','none')
end
Colorbar title is added by
h.Label.String='title'
  댓글 수: 12
yogan sganzerla
yogan sganzerla 2018년 8월 6일
Mr Jonas?
Do you know how to change it?
Cheers
jonas
jonas 2018년 8월 6일
Will give it a try! I have seen your other question, will reply there if I come up with an answer.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by