cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Hans_Hsu
Level I

How to create XY axis data for a circle and key into data table

I would like to draw a circle in graph builder.

I know that one way is using "customize" function in graph build, then use code like below to draw a circle

Pen Color( "orange" );
Pen Size( 2 );
Circle( {0, 0}, 100 );

 

But I need another way, that is, provide X,Y data in data table, then draw a X-Y map in graph builder

Approximately  50 points data of a circle would be enough for me 

So is there any way to quickly generate XY data for a circle?

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to create XY axis data for a circle and key into data table

Here is one way to generate it

circle.PNG

Names Default To Here( 1 );
dt = New Table( "circle", New Column( "x" ), New Column( "y" ) );

radius = 100;
        
r2 = radius * radius;
For( x = -radius, x <= radius, x++,
	y = floor(Sqrt( r2 - x * x ) + 0.5);
	dt<<add rows( 1 );
	dt:x[N Rows( dt )] = x;
	dt:y[N Rows( dt )] = y;
	dt<<add rows( 1 );
	dt:x[N Rows( dt )] = x;
	dt:y[N Rows( dt )] = -1*y;
);

Graph Builder(
	Size( 506, 501 ),
	Variables( X( :x ), Y( :y ) ),
	Elements( Points( X, Y, Legend( 3 ) ) )
);
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: How to create XY axis data for a circle and key into data table

Here is one way to generate it

circle.PNG

Names Default To Here( 1 );
dt = New Table( "circle", New Column( "x" ), New Column( "y" ) );

radius = 100;
        
r2 = radius * radius;
For( x = -radius, x <= radius, x++,
	y = floor(Sqrt( r2 - x * x ) + 0.5);
	dt<<add rows( 1 );
	dt:x[N Rows( dt )] = x;
	dt:y[N Rows( dt )] = y;
	dt<<add rows( 1 );
	dt:x[N Rows( dt )] = x;
	dt:y[N Rows( dt )] = -1*y;
);

Graph Builder(
	Size( 506, 501 ),
	Variables( X( :x ), Y( :y ) ),
	Elements( Points( X, Y, Legend( 3 ) ) )
);
Jim

Recommended Articles