cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
Kip1
Level II

plot secondary y-axis with conversion scale

JMP Pros,

I have variable y1 consisting of integer scores from 1 to 9. I created a second conditional variable y2 as:

 

 

If(:y1 == 3, "4",

        :y1 == 5, "3",

        :y1 == 7, "2")

 

 

which converts the integer score values in y1 to corresponding values on a measured scale (millimeters).

When I plot both variables in Graph Builder, the y2 axis is scaled independently of y1 whereas, what I want is for the y1 primary (left) axis scaled in score values and the the y2 secondary (right) axis displaying the mm conversion. For example, plotted y1 score values of 5 would correspond to 3 on the secondary axis and so on. RIght now, when I drag both variables into GB, it plots two sets of data with independently scaled y axes. How are conversion scales plotted on a secondart y-axis in JMP?

 

Thanks!

4 REPLIES 4

Re: plot secondary y-axis with conversion scale

A couple of potential issues here.

 

I noticed that your formula creates Y2 as a character string. I don't think I would do that. If Y2 is a continuous measure (and mm seems to fit that definition), then I would treat the value as continuous.

 

The other issue is that as Y1 goes up, Y2 is going down. This will cause the mis-match on the scaling.

 

I see two possible approaches. Both of them would have you create Y2 as a numeric value. 

 

Approach Number 1: Make Y2 an exact copy of Y1, but then specify value labels to change them to be the mm result. Because you are not changing the actual data, it will be plotted in the correct order and at correct locations, but you are only changing the value that is displayed. The disadvantage is that if you have a true function to compute the mms, then there could be lots of typing for the various mm settings.

 

Approach Number 2: Use your formula for Y2, except make it numeric, not character. Drag Y2 into the Graph Builder and move it to the right-axis. Now right-click the right axis and choose Axis Settings. In the upper-left of the dialog box, check the "Reverse Order" box. That should solve the problem.

Dan Obermiller
txnelson
Super User

Re: plot secondary y-axis with conversion scale

If the right axis to left axis values can be specified in a continuous function, you can use a graphics script to automatically change the left axis if the right axis is modified, and vice versa.  

Jim
Kip1
Level II

Re: plot secondary y-axis with conversion scale

Thanks for the reply. The data type for y1 is actually numeric ordinal, taking values from 1 to 9 using qualitative descriptors like "undetectable" to "very large". The purpose of y2 is to convert the ordered values for y1 to an equivalent quantitative scale y2 that's more intuitive. However, I couldn't get either approach to match up correctly, even when specifying a numeric continuous data type. The values for y1 and y2 change in opposite directions but are not exactly inversely related.

Re: plot secondary y-axis with conversion scale

Because the Y2 scale is not exactly inversely related, my approach number 1 would be the way to go. Create a new column that is an exact copy of Y1, but use the Value Labels column property to specify the values in the proper order to display.

 

If approach #1 is not working for you, I will need to see a bit more of some fictional data for an example.

Dan Obermiller