Hello, I have two question

Hello, I have two question-
  1. I need to plot the below figure in a new form which should show only the region which is blue in color into red color and in a transparent cube. The figure should not show any other mesh except the blue region (in red with mesh).
  2. Second thing is at present the dimension displaying on each axis is according to the size of meshgrid(49*33*33), I need to change it to actual room size (12*4*5).
Thanks for your help

8 Comments

Jan
Jan on 28 May 2017
Show us the code, which is used to create the current diagram. Then it is very easy to suggest the changes.
Nikita Johnson
Nikita Johnson on 28 May 2017
Edited: dpb on 28 May 2017
% figure
xslice = (1:1:33); %YZ plane over different x-values
yslice = (1:1:49); %XZ plane over different Y-values
zslice = (1:1:33); %XY plane over different z-values
[X, Y, Z] = meshgrid(xslice, yslice, zslice );
hi = slice(X,Y,Z,data_inter,[1,33],[1,49],1); %hi = structure for interpolated data
xlabel('x-axis')
ylabel('y-axis') %Mind this , explained above*
zlabel('z-axis')
% doc annotation
colormap hsv
colorbar
Can Anyone answer my question please?
You plot does not have the same colormap as your code. colormap hsv starts with pure red at its lowest bounds, and goes up through a number of colors, ending in impure red at its top end. Your plot starts at yellow at its bottom end and goes to blue at its top end. Your colormap does not correspond to any of the pre-defined colormaps.
This is important because you have defined your boundary in terms of "blue", and in order to figure out what that means in terms of data values, we need to look at the colormap values and examine the RGB components and try to figure out from them which entries are "blue", and then use that information to project back to data values. If we knew the construction rules for the colormap then we might be able to use the defining principles to try to sensibly answer the question "What is 'blue' ?" Does "blue" include teal? Does it include "azure" ? What is the dividing line between "blue" and "purple" ?
Now, if we had seen your real code, then just maybe we would have seen you write integer values into data_inter and construct a custom colormap and perhaps the combination would have been enough for us to unambiguously figure out what range of values in data_inter had to be plotted separately.
Or, you know, you could just tell us.
if true
figure
xslice = (1:1:33); %YZ plane over different x-values
yslice = (1:1:49); %XZ plane over different Y-values
zslice = (1:1:33); %XY plane over different z-values
[X, Y, Z] = meshgrid(xslice, yslice, zslice );
hi = slice(X,Y,Z,data_inter,[1,33],[1,49],1);
xlabel('x-axis')
ylabel('y-axis') %Mind this , explained above*
zlabel('z-axis')
% doc annotation
colorbar
end
This is the code and this is the figure I am talking about.
1. I need to plot of the above figure in a new form which should show only the region which is yellow in color into red color and in a transparent cuboid box. The figure should not show any other mesh except the yellow region (into red color mesh).
2.Second thing is at present the dimension displaying on each axis is according to the size of meshgrid(49*33*33), I need to change it to actual room size (12*4*5).
What I am looking for is something like the below figure, except the grey region should be red.
We are not able to assist you until you define what "blue" is exactly (since you said it had to be the "blue" that was copied and we do not know what "blue" means); or until you define the range of values in data_inter that you want to be copied to the new figure.
Nikita Johnson
Nikita Johnson on 30 May 2017
Edited: Nikita Johnson on 30 May 2017
@Walter Roberson, Sir, In the last picture, the yellow represents the region of the dataset (data_inter; of size 49*33*33) which is equal to 1 and "blue" represents all those values which are zeros. Now I wish to plot only yellow region inside cuboid and "blue" should not get plotted.
In simple words, there is 3D meshgrid of size 49*33*33 and represents two values 1 and zeros, I just wish to plot only one of them at a time.
Kindly Help

Sign in to comment.

Answers (1)

figure
xslice = (1:1:33); %YZ plane over different x-values
yslice = (1:1:49); %XZ plane over different Y-values
zslice = (1:1:33); %XY plane over different z-values
[X, Y, Z] = meshgrid(xslice, yslice, zslice );
data_copy = data_inter;
data_copy(data_copy ~= 1) = nan;
hi = slice(X,Y,Z,data_inter,[1,33],[1,49],1);
xlabel('x-axis')
ylabel('y-axis') %Mind this , explained above*
zlabel('z-axis')
colormap([0 0 0; 1 0 0]);
caxis([0 1])

3 Comments

Respected Walter sir,
I am getting this output and this is not as expected. please help
Nikita Johnson
Nikita Johnson on 29 Jun 2017
Edited: Nikita Johnson on 29 Jun 2017
I wish to tell you that, this is what I am looking for in this video, but the thing is, the size of data in this video is 5532 * 3 and mine is 49*33*33
https://www.youtube.com/watch?v=Q5TDrQ2dLJg&index=11&list=PLi2lWuI3Qlg0B8ZTlmPEU7S9mvJOgOKFA#t=166.10518
You do not appear to have attached your data for us to test with.

Sign in to comment.

Asked:

on 27 May 2017

Commented:

on 5 Jul 2017

Community Treasure Hunt

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

Start Hunting!