help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Plotting Lines in 3D


From: Richardson, Anthony
Subject: RE: Plotting Lines in 3D
Date: Thu, 6 Aug 2015 13:21:59 +0000

> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On
> Behalf Of Thomas D. Dean
> Sent: Wednesday, August 5, 2015 11:12 PM
> To: address@hidden
> Subject: Plotting Lines in 3D
> 
> I have an array of 100 pairs of points, 100 rows, 6 columns, the columns
> representing  x1, y1, z1   x2, y2, z2.
> A straight line from Point 1 to Point 2.
> 
> I want to plot this in 3D, resulting in 100 straight lines.
> 
> I tried
>   hold on; for idx=1:100 plot3(X(idx,:)) endfor; hold off; strange.
> 
> plot3(X(1,:)) does not result in a straight line.  The (wrong?) way I read the
> help, it should.
> 
> How do I do this?
> 
> Tom Dean
> 
> X =
>    -0.24537   0.00000   3.02878  -0.24537  -0.74948   3.02878
>    -0.21714   0.00000   3.02693  -0.21714   0.66326   3.02693
>    -0.19216   0.00000   3.02529  -0.19216  -0.58695   3.02529
>    -0.17005   0.00000   3.02385  -0.17005   0.51943   3.02385
>    -0.15049   0.00000   3.02256  -0.15049  -0.45967   3.02256
>    -0.13317   0.00000   3.02143  -0.13317   0.40679   3.02143
>    -0.11785   0.00000   3.02042  -0.11785  -0.35999   3.02042
>    -0.10430   0.00000   3.01954  -0.10430   0.31857   3.01954
>    -0.09230   0.00000   3.01875  -0.09230  -0.28192   3.01875
>    -0.08168   0.00000   3.01805  -0.08168   0.24949   3.01805
>    -0.07228   0.00000   3.01744  -0.07228  -0.22079   3.01744
>    -0.06397   0.00000   3.01689  -0.06397   0.19539   3.01689
>    -0.05661   0.00000   3.01641  -0.05661  -0.17291   3.01641
>    -0.05009   0.00000   3.01598  -0.05009   0.15302   3.01598
>    -0.04433   0.00000   3.01561  -0.04433  -0.13541   3.01561
>    -0.03923   0.00000   3.01527  -0.03923   0.11984   3.01527
>    -0.03472   0.00000   3.01498  -0.03472  -0.10605   3.01498
>    -0.03072   0.00000   3.01471  -0.03072   0.09385   3.01471
>    -0.02719   0.00000   3.01448  -0.02719  -0.08305   3.01448
>    -0.02406   0.00000   3.01428  -0.02406   0.07350   3.01428
>    -0.02129   0.00000   3.01410  -0.02129  -0.06504   3.01410
>    -0.01884   0.00000   3.01394  -0.01884   0.05756   3.01394
>    -0.01668   0.00000   3.01379  -0.01668  -0.05094   3.01379
>    -0.01476   0.00000   3.01367  -0.01476   0.04508   3.01367
>    -0.01306   0.00000   3.01356  -0.01306  -0.03989   3.01356
>    -0.24537  -0.00000   2.97122  -0.24537   0.74948   2.97122
>    -0.21714  -0.00000   2.97307  -0.21714  -0.66326   2.97307
>    -0.19216  -0.00000   2.97471  -0.19216   0.58695   2.97471
>    -0.17005  -0.00000   2.97615  -0.17005  -0.51943   2.97615
>    -0.15049  -0.00000   2.97744  -0.15049   0.45967   2.97744
>    -0.13317  -0.00000   2.97857  -0.13317  -0.40679   2.97857
>    -0.11785  -0.00000   2.97958  -0.11785   0.35999   2.97958
>    -0.10430  -0.00000   2.98046  -0.10430  -0.31857   2.98046
>    -0.09230  -0.00000   2.98125  -0.09230   0.28192   2.98125
>    -0.08168  -0.00000   2.98195  -0.08168  -0.24949   2.98195
>    -0.07228  -0.00000   2.98256  -0.07228   0.22079   2.98256
>    -0.06397  -0.00000   2.98311  -0.06397  -0.19539   2.98311
>    -0.05661  -0.00000   2.98359  -0.05661   0.17291   2.98359
>    -0.05009  -0.00000   2.98402  -0.05009  -0.15302   2.98402
>    -0.04433  -0.00000   2.98439  -0.04433   0.13541   2.98439
>    -0.03923  -0.00000   2.98473  -0.03923  -0.11984   2.98473
>    -0.03472  -0.00000   2.98502  -0.03472   0.10605   2.98502
>    -0.03072  -0.00000   2.98529  -0.03072  -0.09385   2.98529
>    -0.02719  -0.00000   2.98552  -0.02719   0.08305   2.98552
>    -0.02406  -0.00000   2.98572  -0.02406  -0.07350   2.98572
>    -0.02129  -0.00000   2.98590  -0.02129   0.06504   2.98590
>    -0.01884  -0.00000   2.98606  -0.01884  -0.05756   2.98606
>    -0.01668  -0.00000   2.98621  -0.01668   0.05094   2.98621
>    -0.01476  -0.00000   2.98633  -0.01476  -0.04508   2.98633
>    -0.01306  -0.00000   2.98644  -0.01306   0.03989   2.98644
>    -0.24537   0.00000   3.02878  -0.21714   0.00000   3.02693
>    -0.21714   0.00000   3.02693  -0.19216   0.00000   3.02529
>    -0.19216   0.00000   3.02529  -0.17005   0.00000   3.02385
>    -0.17005   0.00000   3.02385  -0.15049   0.00000   3.02256
>    -0.15049   0.00000   3.02256  -0.13317   0.00000   3.02143
>    -0.13317   0.00000   3.02143  -0.11785   0.00000   3.02042
>    -0.11785   0.00000   3.02042  -0.10430   0.00000   3.01954
>    -0.10430   0.00000   3.01954  -0.09230   0.00000   3.01875
>    -0.09230   0.00000   3.01875  -0.08168   0.00000   3.01805
>    -0.08168   0.00000   3.01805  -0.07228   0.00000   3.01744
>    -0.07228   0.00000   3.01744  -0.06397   0.00000   3.01689
>    -0.06397   0.00000   3.01689  -0.05661   0.00000   3.01641
>    -0.05661   0.00000   3.01641  -0.05009   0.00000   3.01598
>    -0.05009   0.00000   3.01598  -0.04433   0.00000   3.01561
>    -0.04433   0.00000   3.01561  -0.03923   0.00000   3.01527
>    -0.03923   0.00000   3.01527  -0.03472   0.00000   3.01498
>    -0.03472   0.00000   3.01498  -0.03072   0.00000   3.01471
>    -0.03072   0.00000   3.01471  -0.02719   0.00000   3.01448
>    -0.02719   0.00000   3.01448  -0.02406   0.00000   3.01428
>    -0.02406   0.00000   3.01428  -0.02129   0.00000   3.01410
>    -0.02129   0.00000   3.01410  -0.01884   0.00000   3.01394
>    -0.01884   0.00000   3.01394  -0.01668   0.00000   3.01379
>    -0.01668   0.00000   3.01379  -0.01476   0.00000   3.01367
>    -0.01476   0.00000   3.01367  -0.01306   0.00000   3.01356
>    -0.01306   0.00000   3.01356   0.00000   0.00000   3.01270
>    -0.24537   0.00000   2.97122  -0.21714   0.00000   2.97307
>    -0.21714   0.00000   2.97307  -0.19216   0.00000   2.97471
>    -0.19216   0.00000   2.97471  -0.17005   0.00000   2.97615
>    -0.17005   0.00000   2.97615  -0.15049   0.00000   2.97744
>    -0.15049   0.00000   2.97744  -0.13317   0.00000   2.97857
>    -0.13317   0.00000   2.97857  -0.11785   0.00000   2.97958
>    -0.11785   0.00000   2.97958  -0.10430   0.00000   2.98046
>    -0.10430   0.00000   2.98046  -0.09230   0.00000   2.98125
>    -0.09230   0.00000   2.98125  -0.08168   0.00000   2.98195
>    -0.08168   0.00000   2.98195  -0.07228   0.00000   2.98256
>    -0.07228   0.00000   2.98256  -0.06397   0.00000   2.98311
>    -0.06397   0.00000   2.98311  -0.05661   0.00000   2.98359
>    -0.05661   0.00000   2.98359  -0.05009   0.00000   2.98402
>    -0.05009   0.00000   2.98402  -0.04433   0.00000   2.98439
>    -0.04433   0.00000   2.98439  -0.03923   0.00000   2.98473
>    -0.03923   0.00000   2.98473  -0.03472   0.00000   2.98502
>    -0.03472   0.00000   2.98502  -0.03072   0.00000   2.98529
>    -0.03072   0.00000   2.98529  -0.02719   0.00000   2.98552
>    -0.02719   0.00000   2.98552  -0.02406   0.00000   2.98572
>    -0.02406   0.00000   2.98572  -0.02129   0.00000   2.98590
>    -0.02129   0.00000   2.98590  -0.01884   0.00000   2.98606
>    -0.01884   0.00000   2.98606  -0.01668   0.00000   2.98621
>    -0.01668   0.00000   2.98621  -0.01476   0.00000   2.98633
>    -0.01476   0.00000   2.98633  -0.01306   0.00000   2.98644
>    -0.01306   0.00000   2.98644   0.00000   0.00000   2.98730
> 
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-octave

Does this:

        plot3([X(:,1)'; X(:,4)'], [X(:,2)'; X(:,5)'],[X(:,3)'; X(:,6)']);

produce the figure you want?  (Just a single line, do not place inside a for 
loop.)

Tony Richardson



reply via email to

[Prev in Thread] Current Thread [Next in Thread]