cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
XanGregg
Staff

Ways to draw a heart in JMP?

Here's one way to do it, using parametric equations found at Math World: Heart Curve.

 

 

New Table( "heart",
	New Column( "t", Set Values( Index( 0, 2 * Pi(), 0.1 ) ) ),
	New Column( "x", Formula( 16 * Power( Sin(t), 3 ) ) ),
	New Column( "y", Formula( 13 * Cos(t) - 5 * Cos(2 * t) - 2 * Cos(3 * t) - Cos(4 * t) ) )
);

Graph Builder( Show Control Panel( 0 ), Variables( X( :x ), Y( :y ), Legend( 1 )), Elements( Formula( X, Y ) ),
	SendToReport( Dispatch( {}, "400", ScaleBox,
		{Legend Model( 1, Properties( 0, {Line Color( "Red" ), Line Width( 4 )} ) )})
	)
 );

heart1.png

 

27 REPLIES 27

Re: Ways to draw a heart in JMP?

DOE > Special Purpose > Space Filling Design will do it, too, with a Disallowed Combinations Script.

FFFheart.jpgScreen Shot 2017-02-14 at 2.49.56 PM.png

Connect with me on LinkedIn: https://bit.ly/3MWgiXt

Re: Ways to draw a heart in JMP?

You can also get the 3D version of this by using the appropriate heart surface as the disallowed combination expression.Screen Shot 2017-02-14 at 3.15.15 PM.png

 

 

 

 

Connect with me on LinkedIn: https://bit.ly/3MWgiXt
arati_mejdal
Level XI

Re: Ways to draw a heart in JMP?

Love this one!
Read the JMP Blog: jmp.com/blog
arati_mejdal
Level XI

Re: Ways to draw a heart in JMP?

Love this one!

Read the JMP Blog: jmp.com/blog
Craige_Hales
Super User

Re: Ways to draw a heart in JMP?

New Window( "heart",
	Text Box(
		"\!U2661",
		<<setfontname( "Arial Unicode MS" ),
		<<setFontScale( 20 ),
		<<fontcolor( "red" )
	)
);

U2661 is a heartU2661 is a heart

 

SetFontScale is new for JMP 13.

Craige
nascif_jmp
Level VI

Re: Ways to draw a heart in JMP?

This animated gif shows a web application that generates 1000 random points every time the link is clicked. It then uses a JMP neural network model exported as JavaScript to score each location. The result - inside or outside the parametric "heart" curve - is used to assign color and size.

heart_in_browser.gif

Craige_Hales
Super User

Re: Ways to draw a heart in JMP?

Here's a transparent heart, built on top of the 3D equation Dan found. Running the script is way more satisfying than the picture.

Surface Plot(
	Show formula( 1 ),
	Mode( "Isosurface" ),
	Resolution( 101 ), 
	Surface Color( "Red" ), 
	Equation( "(x^2+9*y^2/4+z^2-1)^3-x^2*z^3-9*y^2*z^3/80" ),
	SetVariableAxis( x, Axis Data( {Min( -1.3 ), Max( 1.3 ), Inc( 0.5 ), Minor Ticks( 1 )} ) ),
	SetVariableAxis( y, Axis Data( {Min( -2 ), Max( 3 ), Inc( 1 ), Minor Ticks( 1 )} ) ),
	SetVariableAxis( z, Axis Data( {Min( -1.3 ), Max( 1.3 ), Inc( 0.5 ), Minor Ticks( 1 )} ) ),
	SetXVariable( x ),
	SetYVariable( y ),
	Frame3D( Set Graph Size( 700, 700 ), Set Spin( 0.004, 0, -0.5, -0.3 ), Set Rotation( -90, -10, 45 ) ), 
);

3D heart3D heart

The surface plot takes the equation in X,Y,Z and shows the semi-transparent iso-surface.

Craige
ryandewitt
Community Manager Community Manager

Re: Ways to draw a heart in JMP?

These are all fantastic, really enjoyed them today. 

Ryan DeWitt - JMP User Enablement | Creative • Video • Design • Learning
MathStatChem
Level VI

Re: Ways to draw a heart in JMP?

Here's a way to do it using drawing functions (no data table required):

Names Default To Here( 1 );

func_HeartFilledPolygon = Function( 
	{},
	{_HeartShapeX, _HeartShapeY, t=0::2*Pi()::0.1}, 
		
	_HeartShapeY = 13 * Cos( t ) - 5 * Cos( 2 * t ) - 2 * Cos( 3 * t ) - Cos( 4 * t ) ;
	_HeartShapeX = Power( Sin( t ), 3 );

	Eval( Substitute( Expr( Polygon( Expr( shape_x ), Expr( shape_y ) ) ), Expr( shape_x ), _HeartShapeX, Expr( shape_y ), _HeartShapeY ) );
); 


new window("Belated Valentines Day", 
	_ob=OutlineBox("Heart",
		_hlb=HListBox(
			_grbox=Graph Box(
				X Scale(-1.5, 1.5),
				Y Scale(-20, 15),
				XName(""),
				YName(""),
				Fill Color("red");
				func_HeartFilledPolygon();
				)
			)
		)
	);

Heart.png

 

arati_mejdal
Level XI

Re: Ways to draw a heart in JMP?

Nice!
Read the JMP Blog: jmp.com/blog