From: Rui Silva on
Hi folks!

I have trying to plot several figures in one plot and using one colorbar.

I have read the posts around and I got working except one thing: I can't seem to
connect the data to the colorbar....I want the the colorbar to respresent the data in both figures....like in this example:

http://www.mathworks.com/support/solutions/en/data/1-16FPP/

Also in case anyone is familiar I'm using EIDORS to create my images.

I have something like this:

% Reconstruct Image 1
imdl_2D.solve= 'aa_inv_solve'; % Choice for Inverse Algorithm
imdl_2D.fwd_model.normalize_measurements= 1;
imdl_2D.hyperparameter.value= 5; % This way I can change hyperparameter easily
rec_img= inv_solve(imdl_2D, Vh, Vi);
ax(1)=subplot(2,1,1)
show_fem(rec_img,[1,1])
axis off
..
..
..
% Reconstruct Image 2
imdl_2D.solve= 'aa_inv_solve'; % Choice for Inverse Algorithm
imdl_2D.fwd_model.normalize_measurements= 1;
imdl_2D.hyperparameter.value= 5; % This way I can change hyperparameter easily
rec_img= inv_solve(imdl_2D, Vh, Vi);

ax(2)=subplot(2,1,2)
show_fem(rec_img1,[1,1])
axis off

I am trying to connect the data from both images to the colorbar but I'm not successfull....Any input would be appreciated..

Cheers!

Rui

h=colorbar;
set(h, 'Position', [.8314 .11 .0581 .8150])
for i=1:2
pos=get(ax(i), 'Position');
axes(ax(i))
set(ax(i), 'Position', [pos(1) pos(2) .6626 pos(4)])
end
From: Ross W on
"Rui Silva" <el_tuka(a)iol.pt> wrote in message <i2pm88$er8$1(a)fred.mathworks.com>...
> Hi folks!
>
> I have trying to plot several figures in one plot and using one colorbar.
>
> I have read the posts around and I got working except one thing: I can't seem to
> connect the data to the colorbar....I want the the colorbar to respresent the data in both figures....like in this example:
>
> http://www.mathworks.com/support/solutions/en/data/1-16FPP/
>
> Also in case anyone is familiar I'm using EIDORS to create my images.
>
> I have something like this:
>
> % Reconstruct Image 1
> imdl_2D.solve= 'aa_inv_solve'; % Choice for Inverse Algorithm
> imdl_2D.fwd_model.normalize_measurements= 1;
> imdl_2D.hyperparameter.value= 5; % This way I can change hyperparameter easily
> rec_img= inv_solve(imdl_2D, Vh, Vi);
> ax(1)=subplot(2,1,1)
> show_fem(rec_img,[1,1])
> axis off
> .
> .
> .
> % Reconstruct Image 2
> imdl_2D.solve= 'aa_inv_solve'; % Choice for Inverse Algorithm
> imdl_2D.fwd_model.normalize_measurements= 1;
> imdl_2D.hyperparameter.value= 5; % This way I can change hyperparameter easily
> rec_img= inv_solve(imdl_2D, Vh, Vi);
>
> ax(2)=subplot(2,1,2)
> show_fem(rec_img1,[1,1])
> axis off
>
> I am trying to connect the data from both images to the colorbar but I'm not successfull....Any input would be appreciated..
>
> Cheers!
>
> Rui
>
> h=colorbar;
> set(h, 'Position', [.8314 .11 .0581 .8150])
> for i=1:2
> pos=get(ax(i), 'Position');
> axes(ax(i))
> set(ax(i), 'Position', [pos(1) pos(2) .6626 pos(4)])
> end

Hi

It's not clear what you mean when you say the code was not successful. Can you clarify?

This code with the set( ,'Position', ) will change the location of the colorbar, but it does not connect the colorbar to the data in both subplots.
The code you have seems to work for changing the size of the colorbar, given the default matlab figure window.

The range of colors in the colorbar refers only the second subplot. Is that the problem you have? i.e. your subplots have different data ranges?

If so then one option is to use caxis to force them to be the same.

Ross
 | 
Pages: 1
Prev: Mass distributions?
Next: USAF datcom import help