turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Can I use a list to populate the X and Y axis in g...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Aug 10, 2014 12:37 PM
(1123 views)

I have a list of X and Y values that the user selects. I want those list values to populate the x and y axis in graph builder. Is this possible.? I continually get an error that the column names cannot be found?

For example:

x_values = {"x1", "x2", "x3"}

y_values = {'y1", "y2", "y3"}

I want the x axis to be the x_values and the y axis to be the y_values. This changes by how the user selects though so the values cannot be hardcoded.

4 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Aug 11, 2014 10:24 AM
(974 views)

Try something like this:

dt = open**(**"$sample_data\Big Class.jmp"**)**;

column**(**dt, "height"**)** << **set name(**"x1"**)**;

column**(**dt, "weight"**)** << **set name(**"y3"**)**;

x_values = **{**"x1", "x2", "x3"**}**;

y_values = **{**"y1", "y2", "y3"**}**;

Graph Builder**(**

Show Control Panel**(** **0** **)**,

Variables**(** X**(** :column**(**dt, x_values**[****1])** **)**, Y**(** column**(**dt, y_values**[****3])** **)** **)**,

Elements**(** Points**(** X, Y, Legend**(** **1** **)**, Jitter**(** **1** **)** **)** **)**

**)**;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Aug 11, 2014 10:40 AM
(974 views)

If you need to put all of the selections in at once (for multiple variables on X and Y axes simultaneously), and you don't know the size of the lists in advance, you could do something involving expressions, which is a somewhat advanced, but flexible, technique. Here's an example. Note that gbExpr is the simply whatever code you want for graph builder, except for the Variables() part, which we will build dynamically:

dt = Open( "$Sample_Data/Car Physical Data.jmp" );

x_values = {"Country", "Type", "Weight"};

y_values = {"Turning Circle", "Displacement", "Horsepower"};

gbExpr = Expr( Graph Builder() );

varExpr = Expr( Variables() );

For( i = 1, i <= N Items( x_values ), i++,

Insert Into( varExpr, Parse( "X( :" || x_values* || ")" ) )*

);

For( i = 1, i <= N Items( y_values ), i++,

Insert Into( varExpr, Parse( "Y( :" || y_values* || ")" ) )*

);

Insert into( gbExpr, Name Expr( varExpr ) );

gbExpr;

Cheers,

Brady

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Aug 12, 2014 3:03 PM
(974 views)

Thanks for your help!

Unfortunately when I try to run this I get the following error:

Unexpected ")".

Trying to parse operand for "-" operator.

Line 1 Column 12: Y( : A-3 - ►)

My list of Y variables looks like this y_variables = {" A-3-", " A-4-"}

I also am not not trying to put multiple y variables on the same axis. I want each of the y variables to be its own graph sorted by the same x values. I just need the y axis in graph builder to be able to change based on what is in the y_variables list (this list is options that the user selects).

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 16, 2017 5:23 AM
(943 views)

hello,

i need to populate graph builder with some dispatch...

but im not able to pass the string "400" by script becasue the char** " "**

SendToReport**(**

Dispatch**(**

**{}**,

"400",

ScaleBox,

can you help me , thank you

Gianpaolo

can

Gianpaolo Polsinelli