cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
patriciafm811
Level II

Create this type of graph

I have been asked to make a graph like the one below, comparing one year to another. But I have no idea how to do this in JMP (or anything else honestly). Can anyone help point me in the right direction?

patriciafm811_0-1706618953806.png

 

5 REPLIES 5
txnelson
Super User

Re: Create this type of graph

Here is one way to accomplish this.  Given a data table 

txnelson_0-1706626306211.png

I produced the below chart, using Graph Builder, with Added graphics

txnelson_1-1706626388765.png

Below is the JSL that produced the above graph

Names Default To Here( 1 );

dt = Data Table( "Example" );

gb = dt << Graph Builder(
	Size( 648, 450 ),
	Show Control Panel( 0 ),
	Variables( X( :Month ), Y( :Value ) ),
	Elements( Points( X, Y, Legend( 3 ), Error Interval( "Range" ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Value",
			ScaleBox,
			{Min( -8.0923781757601 ), Max( 122.008163265306 ), Inc( 20 ),
			Minor Ticks( 0 )}
		),
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				3,
				Properties( 0, {Line Color( 16 )}, Item ID( "Value", 1 ) ),
				Properties( -1, {Line Color( 16 )}, Item ID( "Jan", 1 ) ),
				Properties( -1, {Line Color( 16 )}, Item ID( "Mean", 1 ) )
			)}
		),
		Dispatch(
			{},
			"graph title",
			TextEditBox,
			{Set Text( "Previous 5-year average  2023" )}
		),
		Dispatch( {}, "X title", TextEditBox, {Set Text( "" )} ),
		Dispatch( {}, "Y title", TextEditBox, {Set Text( "" )} ),
		Dispatch( {}, "400", LegendBox, {Legend Position( {3, [-1, -3]} )} )
	)
);

// Add the Circles and Lines
Report( gb )[FrameBox( 1 )] <<
Add Graphics Script(
	For Each Row(
		If( :Type == "High",
			Fill Color( "Gray" );
			theHigh = :Value;
			theLow = :Value[Row() + 1];
			Pen Color( "Gray" );
			Pen Size( 4 );
			X = Matrix( Floor( Row() / 2 ) ) || Matrix( Floor( Row() / 2 ) );
			y = Matrix( theHigh ) || Matrix( theLow );
			Line( X, Y );
			theList = {};
			Insert Into( theList, X[1] );
			Insert Into( theList, Y[1] );
			Circle( theList, 7, "Fill" );
		,
			Fill Color( "Red" );
			theList = {};
			Show( Floor( Row() - 1 ) );
			Insert Into( theList, Floor( (Row() - 1) / 2 ) );
			Insert Into( theList, :value );
			Circle( theList, 7, "Fill" );
			// Add the numerical value in the circle
			Text Color( "White" );
			// Subtract a fudge factor to better center the text
			theList[2] = :Value - 3;
			Text Font( "Segoe UI", 14, "Bold" );
			Text( Center Justified, theList, Char( :Value ) );
		)
	)
);
Jim
patriciafm811
Level II

Re: Create this type of graph

This is helping a LOT. What if (instead of high and low) I wanted to do the year? 

patriciafm811
Level II

Re: Create this type of graph

Here is the data file I am using. I really want to compare it month by (one for each virus) for 2022 and 2023.

txnelson
Super User

Re: Create this type of graph

Using @scott_allen method(much better than mine), and your data I created these graphs interactively using Graph Builder.

txnelson_0-1706643787269.png

The only things I had to do to your data was to

  1. subset the data keeping only the data for years 2022 and 2023.
  2. Split the subsetted data table using  Tables=>Split, 
    1. Split By: Year
    2. Split Columns: Rate
    3. Select "Keep All"

Using the new split data table

txnelson_1-1706644193525.png

  1. Opened Graph Builder
  2. To make separate graphs for each virus, I selected Virus and dragged it to the Page drop sone.
  3. Selected the Month column and dragged it to the X axis drop zone
  4. Select both columns 2022 and 2023  and dragged them to the Y axis drop zone
  5. To relate the 2 year columns, select 2022 and 2023 and drag them to the Interval drop zone
  6. In the legend, right click on the blue dot and select Marker Size
    1. Select "Other"
    2. The type in 40
  7. Repeat step 6 for the red dot
  8. You can right click on the dots and change the colors to your liking

The most important thing to do is to read the documentation available under the Help Pull Down menu.  

  1. Discovering JMP
  2. Using JMP
  3. Essential Graphing (in particular the section on Graph Builder)
Jim

Re: Create this type of graph

Here is another way that gets you pretty close and does not require any scripting.

scott_allen_2-1706631657112.png

 

One way to get this style of graph is to re-shape your data table by splitting the data into two columns, then use those columns in the Interval Dropzone. I learned this trick from @scwise from one of his Pictures from the Gallery series. Everything else is changing colors, adding annotation boxes, and hiding various chart elements. 

https://community.jmp.com/t5/Discovery-Summit-Europe-2022/Pictures-from-the-Gallery-7-Select-Advance...

 

Hope this helps!

-Scott