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
helmon
Level II

Graphbuilder: Side by side bars

Hi,
I have a graph with two Y-axis with different scales.
The bar style is "Side by side" but they seem to cluster together.

I tried to put fewer samples on the graph so there would be fewer bars but that didn´t work.

Any ideas of how to make them side by side and not cluttered together?

Best regards

 

JMP.pngJMP2.png

3 REPLIES 3
SDF1
Super User

Re: Graphbuilder: Side by side bars

Hi @helmon,

 

  This is a strange output. What version of JMP are you using? It could have been a bug in the past. With 14.1.0, I don't seem to have that problem. However, it appears you are also trying to graph many different things, including Group X and Group Y information. This could be the reason why. Do you have to do the Group X/Y? Could you instead put in a local data filter?

 

  I tried with the TitanicPassenger.jmp file to generate a similar kind of output, but unless I specificially changed the bar graph from "side by side" to "nested" it always showed the bars side by side.

 

  Can you share the data table? You could anonymize it so no sensitive information is shared.

 

  If you could provide some more context of what kind of data (nominal/continuous) you're graphing, this might help.

 

Hope this helps!,

DS

helmon
Level II

Re: Graphbuilder: Side by side bars

Hi!

I am using 14.1.0.
I contacted the support team - and apperently it wasn´t a one-click fix.
Here is the answer I got (I had 3 columns, A, B and C (%))

---

Click Tables -> Stack

Select B (%), A (%), and C (%) and click Stack Columns

I named the Stacked Data Column Data Left, but this is optional.

 

Next we need to reformat the new data set

In the dataset that opens from the stack create a new column called Data Right

Copy the values from Data Left into Data Right

Now for the left axis we ONLY want to include the rows from A (%), and the right axis we want ONLY B (%) and C (%)

To do this I chose Rows -> Data Filter

Then Select Label and click Add

Choose A (%) 

Click on the Data Right Column and press delete - thereby deleting the A (%) values from Data Right, and leaving ONLY B (%) and C (%).

Return to the data filter

This time select B (%) and C (%).

Click on the Data Left Column and press delete - thereby deleting B (%) and C (%) values and leaving ONLY the A (%) values.  

 

Finally create the graph

Click on Graph -> Graph builder

Drag Data Left and Data Right to the Y axis

Drag Sample Name to the X axis

Drag Label to Overlay

Change points to bar

Right click on the Y axis and choose Move Right -> Data Right

---

 

But this makes scripting a little harder now (I am trying to streamline scripts so my team can use it for their databases).

I can only find the script when the new dataset comes up, which is:

 

 

Data Table( "Test for JMP" ) << Stack(
	columns( :Name( "B (%)" ), :Name( "A (%)" ), :Name( "C (%)" ) ),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data Left" )
);

 

 

But when I do the additional steps (adding column and the data filtering) – I can´t find the script for that.

I only get the script out of Graph Builder – but that is only for the graph (not how you got there).

SDF1
Super User

Re: Graphbuilder: Side by side bars

Hi @helmon,

 

  Thanks for the update. Is it possible to restructure your data table from the database? I'm guessing not, but that could be part of what is making life harder now. When I get data from others, I often spend more time restructuring it from the Excel source to what JMP likes to work with.

 

  Anyway, I tested this out with the AirlineDelay.jmp file by following your description. I was able to get the following output with the script below.

Snap2.png

 

  The scripting is pretty short, and I got most of it by following the red hot button and viewing the script. I had to look a bit about how to do the formula the most efficient way, but it didn't take too awfully long. You should be able to alter the script below to get your desired output for your data.

 

Names Default to here (1);

Data Table( "AirlineDelays" ) << Stack(
	columns( :Elapsed Time, :Arrival Delay, :Distance ),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data" )
);

Current Data Table() << Set Name("Stackeddt");

Data Table( "Stackeddt" ) << New Column("Distance", Numeric, "Continuous", Formula(Match( :Label, "Distance", :Data )));//this copies over only the distance data
Data Table( "Stackeddt" ) << Select Columns("Distance") << Delete Property("Formula");//this removes the formula property, but is probably not necessary
Data Table( "Stackeddt" ) << New Column("Delay & Time", Numeric, "Continuous", Formula(Match( :Label, "Arrival Delay", :Data, "Elapsed Time", :Data )));//This copies over both the delay and time data
Data Table( "Stackeddt" ) << Select Columns("Distance") << Delete Property("Formula");//this removes the formula property, but is probably not necessary



Graph Builder(
	Size( 534, 448 ),
	Show Control Panel( 0 ),
	Variables(
		X( :Airline ),
		Y( :Distance, Side( "Right" ) ),
		Y( :Name( "Delay & Time" ), Position( 1 ) ),
		Overlay( :Label )
	),
	Elements( Bar( X, Y( 2 ), Legend( 4 ) ), Bar( X, Y( 1 ), Legend( 5 ) ) )
);

Hope this helps!,

DS