cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

How to mark some points in 3D scatter plot

vveeran
4-Participant

How to mark some points in 3D scatter plot

Hi all,

I want to mark some points in the 3D scatter plot to view where that points are located in 3D.

Could someone please tell me, "How to plot the points on the 3D scatter plot

for my following mathcad file ?

I explained clearly about my question in the attached mathcad file.

Please find my mathcad file below.

1 ACCEPTED SOLUTION

Accepted Solutions

> Could you please tell me, what type of brackets do I need to use ?.

You are experiencing problems with P1  because you did not realize that the elements of P1 are 1 x 1 matrices. You have to create them (at least one of them, then copy and edit) in some empty space on your worksheet and then copy and paste it from there.

This was the reason why I showed with P2 how to create the same structure using the "stack" command. The "stack" command is for stacking one matrix on top of another but it can also used with just one argument and if this argument is a scalar, "stack" will return it as 1 x 1 vector.

Basically when plotting points in a 3D-plot you have to provide a 3 x 1 vector and the three vector elements have to be n x 1 vectors consisting of the x, y and z coordinates of the points to be plotted. Thats how P34 works. plotting both points at once.  Another way is to provide those three vectors (lets call them X, Y and Z) as (X,Y,Z) directly in the plot placeholder like you have done with (A,B,E). But I prefer to create one vector with all, assign it to a variable (like "curve3D" in my last file) and use that variable for plotting.

You can see the difference between P1 and P2 if you evaluate both variables:

In case you wonder: The three red points which correspond to P1 in your plot are ( 0 / 0 / A1 ),  ( 1 /  0 / B1 )  and  ( 2 / 0 / E1 ). The 0,1,2  are ORIGIN, ORIGIN+1, ORIGIN+2.

WE

View solution in original post

10 REPLIES 10

Maybe that way:

vveeran
4-Participant
(To:Werner_E)

Dear werner,

Thanks for your answer.

I am new to 3-D plot,

I have some problem, while plotting values of P1, P2 and P34.

For eg, when I include in the 3D-plot like,

(A,B,E),P1

under 3-D Plot Format dialog box - -> General--> plot 2--> scatter plot is invisible.

I can only see like this below under 3-D Plot Format dialog box,

Surface plot, Data points, Bar plot in the above

Contour plot, Vector Field plot, Patch plot  in below.

Could you please tell me, what is the procedure to

make visible "scatter plot" in plot 2 ?

Thanks.

RichardJ
19-Tanzanite
(To:vveeran)

"Data points" means scatter plot.

As Richards says, sometimes "scatter plot" is renamed "Data points", so select that.

Its also possible that you run into the problem that the whole plot fails after adding a scatter plot. Thats a very old bug in the 3Dplot component which was never fixed. If it happens enter the plot format menu, select the newly selected plot and change its type to "Vector Filed Plot". Click "Apply" and then change it back to scatter/DataPoints. This usually solves the problem.

vveeran
4-Participant
(To:Werner_E)

Dear @Werner Exinger,

Thanks once again for detailed information.

After plotting (A,B,E),P1 in 3D scatter plot, the whole plot changes. I followed your procedure, i.e., selecting the

Vector field plot in plot format menu in newly selected plot (plot2) and then once again converting to scatter/Data points

in plot format menu. But, my total plot is not changing to original plot.

I attached my mathcad file here, In the attached file, I drew 2 3D plots, one with original plot (A,B,E) and the other

adding 1 point i.e., (A,B,E),P1.

Could you please tell me what is the problem which I am doing in my code ?

After analyzing, finally, I realize that I am having problem in entering the values of P1.

The brackets used by me and the brackets used by you are different.

Could you please tell me, what type of brackets do I need to use ?.

I attached the code below.

> Could you please tell me, what type of brackets do I need to use ?.

You are experiencing problems with P1  because you did not realize that the elements of P1 are 1 x 1 matrices. You have to create them (at least one of them, then copy and edit) in some empty space on your worksheet and then copy and paste it from there.

This was the reason why I showed with P2 how to create the same structure using the "stack" command. The "stack" command is for stacking one matrix on top of another but it can also used with just one argument and if this argument is a scalar, "stack" will return it as 1 x 1 vector.

Basically when plotting points in a 3D-plot you have to provide a 3 x 1 vector and the three vector elements have to be n x 1 vectors consisting of the x, y and z coordinates of the points to be plotted. Thats how P34 works. plotting both points at once.  Another way is to provide those three vectors (lets call them X, Y and Z) as (X,Y,Z) directly in the plot placeholder like you have done with (A,B,E). But I prefer to create one vector with all, assign it to a variable (like "curve3D" in my last file) and use that variable for plotting.

You can see the difference between P1 and P2 if you evaluate both variables:

In case you wonder: The three red points which correspond to P1 in your plot are ( 0 / 0 / A1 ),  ( 1 /  0 / B1 )  and  ( 2 / 0 / E1 ). The 0,1,2  are ORIGIN, ORIGIN+1, ORIGIN+2.

WE

vveeran
4-Participant
(To:Werner_E)

Dear @Werner Exinger,

Thank you very much for your answer.

But, still I have some doubt in entering the values of P1.

Now, I understood that each elements of P1 are 1*1 matrices.

I can enter easily the first element of P1 by selecting 1 rows and 1 columns in matrix.

I am unable to enter the second element of P1, when I try to enter the second

element of P1 by choosing the same 1 rows and 1 columns in matrix then the

elements of P1 is changed to 2*2 matrix. Similarly, when I try to enter the 3rd  element of

P1, then the value of P1 changes to 3*3 matrix.

Could you please tell me, how to enter 2nd and 3rd values of P1 using 1*1 element matrix ?

I would suggest that you use the method with "stack" for P1, too, as I had demonstrated with P2.

To create the structure for P1 as I did you  type  P1:

and then press ctrl-M (or use the matrix palette) and enter a 3 x 1 column vector. You have now three placeholders to fill with 1 x 1 matrices.

Go to an empty space outside of the just created region and press ctrl-M again to create a 1x1 matrix. Fill the placeholder of that matrix with A1 and then copy the whole expression to the clipboard via ctrl-C. Go to the region with the 3 x 1 matrix and copy the 1x1 from the clipboard to all three place holders via ctrl-V. No you can edit the last two entries to read B1 and E1 instead of A1. Delete the region with the single 1x1 matrix as you won't need it anymore.

Another way would be to type P1[0:(A1) , in another region P1[1:(B1) and then again  P1[2:(E1). You don't type the parenthesis here but insert a 1x1 matrix every time.

Again - stick to the method with "stack" - its quick and easy and you avoid all the hassle.

vveeran
4-Participant
(To:Werner_E)

Dear @Wener,

Thank you very much.

Now, I understood everything clearly.

Addendum:

I had chosen to plot the third and fourth point as one (P34) just to show how to plot a bunch of points with just one plot. The drawback is that all will have the same size an color.

If for color you chose "Colormap" instead of "solid color" you can have different colors for the points but less control about the color unless you provide your own colormap. In the attached example the predefined colormap "Fire" was used.

Find also attached a small animation.

BTW, what exactly are we supposed to see here - what does the data represent?

Top Tags