HP Forums
Changing plot scaling within HPPPL program - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Changing plot scaling within HPPPL program (/thread-21791.html)



Changing plot scaling within HPPPL program - amindanial - 05-25-2024 05:00 AM

I wrote the following code such that a sinusoidal function is drawn point by point using the plot view of Statistics 1Var. The scaling is adjusted according to the maximum values of the x-axis and y-axis. The scaling is updated with each new value of the function.
Unfortunately, the scaling is just adjusted at the first round and not updated after that. Please advise what could be the problem.



Code:

EXPORT Data_Grapher()
BEGIN
LOCAL b,j;
D1:={};
D2:={};
H1(1):="D1";
H1(2):="D2";
H1(3):=4;
STARTAPP("Statistics 1Var");
FOR j FROM 0 TO 360
DO
D1:=append(D1,j);
b:=SIN(j*π/180);
D2:=append(D2,b);
0▶Xmin;
(MAX(D1)*1.1)▶Xmax;
(MIN(D2)-ABS(MIN(D2))*0.1)▶Ymin;
(MAX(D2)+ABS(MAX(D2))*0.1)▶Ymax;
STARTVIEW(1,1);
END;
END;


RE: Changing plot scaling within HPPPL program - roadrunner - 05-27-2024 11:31 AM

Moving STARTVIEW(1,1) outside the DO loop will help. Like this:
Code:

EXPORT Data_Grapher()
BEGIN
LOCAL b,j;
D1:={};
D2:={};
H1(1):="D1";
H1(2):="D2";
H1(3):=4;
STARTAPP("Statistics 1Var");
FOR j FROM 0 TO 360
DO
D1:=append(D1,j);
b:=SIN(j*π/180);
D2:=append(D2,b);
0▶Xmin;
(MAX(D1)*1.1)▶Xmax;
(MIN(D2)-ABS(MIN(D2))*0.1)▶Ymin;
(MAX(D2)+ABS(MAX(D2))*0.1)▶Ymax;
END;
STARTVIEW(1,1);
END;
-road


RE: Changing plot scaling within HPPPL program - amindanial - 05-29-2024 09:04 AM

Many Thanks