Post Reply 
Changing plot scaling within HPPPL program
05-25-2024, 05:00 AM
Post: #1
Changing plot scaling within HPPPL program
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;
Find all posts by this user
Quote this message in a reply
05-27-2024, 11:31 AM
Post: #2
RE: Changing plot scaling within HPPPL program
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
Find all posts by this user
Quote this message in a reply
05-29-2024, 09:04 AM
Post: #3
RE: Changing plot scaling within HPPPL program
Many Thanks
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 3 Guest(s)