简体   繁体   中英

Multiple plot calls in octave

I'm working in octave, I need to call plot3 two or more times to produce one graph. But it only plots the last call of plot3 . I need some help.

This is my code: It only plots the line plot3(tras(1), tras(2), tras(3), 'bo');

    p = [   0.0,    0.0,    0.0
          500.0,    0.0,    0.0
          500.0, -500.0,    0.0
            0.0, -500.0,    0.0
            0.0,    0.0,    0.0];
    mano = [119.818542 -43.371277 50.230591 1];

Tinv = [
 0.998891 -0.001007 0.047065 64.223625
 0.000000 0.999771 0.021382 -291.750854
 -0.047076 -0.021359 0.998663 -1871.334229
 0.000000 0.000000 0.000000 1.000000
]

tras = Tinv*mano'

hold("on");
xlabel("X");
ylabel("Y");
zlabel("Z");

plot3(p(:,1), p(:,2), p(:,3), 'r*-');
plot3(tras(1), tras(2), tras(3), 'bo');

hold("off");
pause;

Your plotting code is fine. Try making the plot extents larger with the axis function. The following change:

% ...

% Usage of axis: axis([xmin xmax ymin ymax zmin zmax])
axis([-100 600 -600 100 -2100 100]);
plot3(p(:,1), p(:,2), p(:,3), 'r*-');
plot3(tras(1), tras(2), tras(3), 'bo');    

% ...

Results in the following plot: 在此输入图像描述

Ideally, you would make the extents values in axis relative to the minimum and maximum coordinate values in p and tras .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM