cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
malurus
Level I

two plots on one graph

Hi all - I'm new to JMP's graph builder. I'm sure this is easy but alas...

I need to present two plots on one graph:
1. bars with s.e. bars (mean long-term rainfall by month)
2. line (no error bars) rainfall data from a single year, also by month

So, same x and same y axes.

Thanks in anticipation.
1 ACCEPTED SOLUTION

Accepted Solutions

Re: two plots on one graph

Hi Malurus,

You are on the right track here. Once you add the two variables to the y-axis, the trick is to use both the Bar and Line graphing elements. (drag and drop the 2nd element onto graph)

 

From there, modify which variable (current or historical rainfall) applies to which graphing element. To do this:

From lefthand panel, expand the Variables menu

Select historical for the Line element

Select current for the Bar element

You can also add the SE bars for the Bar element via this panel 

 

You should end up with something like the image below (lefthand panel items indicated in red):

 

Screen Shot 2020-03-27 at 1.52.07 PM.png

View solution in original post

6 REPLIES 6

Re: two plots on one graph

Malurus,

Can you give us a bit on where you're getting stuck?

You may have more luck with the Overlay plot platform, which lets you plot two y-variables with the same x variable.
malurus
Level I

Re: two plots on one graph

Thanks Eugene,
Here is the work flow (keeping the rainfall example going):
1) drag month onto x
2) drag long-term rainfall data on y
3) right click points -> change to bar
4) right click bar -> add -> error bars -> standard error
So far so good. But, this is where I get stuck:
5) drag rainfall data from a single year (the one I want to be represented by a line) onto the y axis and it displays as a second bar series, (and also adds error bars of 0)
6) if I right click on the second series -> bar -> change to line, both series get changed to line
So my question is how do I change just one series to line (with no se bars), while keeping the other as bars (with se bars)?
ms
Super User (Alumni) ms
Super User (Alumni)

Re: two plots on one graph

I cannot find a way to do it mannually but it seems to be possible via script. Try this (change to your own column names):

Graph Builder(
	Variables( X( :Month ), Y( :MeanRainfall ), Y( :Rainfall, Position( 1 ) ) ),
	Elements(
		Bar(
			X,
			Y( 1 ),
			Legend( 3 ),
			Row order( 0 ),
			Error Bars( "Standard Error" ),
			Summary Statistic( "Mean" )
		),
		Line(
			X,
			Y( 2 ),
			Legend( 3 ),
			Row order( 0 ),
			Error Bars( "Standard Error" ),
			Summary Statistic( "Mean" )
		)
	)
);
malurus
Level I

Re: two plots on one graph

Thanks MS - I appreciate your suggestion.

I tried using your script after altering the column names and couldn't get it to work. But I'm not good with scripts, nor do I have the time to learn how to work with them - if I did I'd be using R!

I'm surprised JMP can't do this - it's not a complicated request and it's fairly routine for programmes like Sigmaplot.

C'mon JMP people! I've got 23 days left on my eval licence and things don't look good for you right now if I have to resort to learning how to use scripts.
ms
Super User (Alumni) ms
Super User (Alumni)

Re: two plots on one graph

Graph builder is a "quick and dirty" way to rapidly explore data graphically. Use the "Chart" platform if you want to make this combined plot manually.

Enter Month and your two Y variables, and make sure "Overlay" is checked and also check "Add error bars to mean". In the legend of the resulting graph, right-click on one variable and change to "Line chart".

And, btw, the scripting in JMP is what sets it apart. You don't have to learn much actual scripting (like in R). Most of the things you do manually can be saved as a script for repeated use. Yet, JMP scripting, can be very powerful.

But if it's just neat graphs you are looking for, JMP may not be for you.

Re: two plots on one graph

Hi Malurus,

You are on the right track here. Once you add the two variables to the y-axis, the trick is to use both the Bar and Line graphing elements. (drag and drop the 2nd element onto graph)

 

From there, modify which variable (current or historical rainfall) applies to which graphing element. To do this:

From lefthand panel, expand the Variables menu

Select historical for the Line element

Select current for the Bar element

You can also add the SE bars for the Bar element via this panel 

 

You should end up with something like the image below (lefthand panel items indicated in red):

 

Screen Shot 2020-03-27 at 1.52.07 PM.png