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

- JMP User Community
- :
- Discussions
- :
- Combining two graphs in one window

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

Highlighted

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

Apr 29, 2020 8:31 AM
(501 views)

Hi,

I have created 2 graphs, each with a column switcher and added them in one single window through the below script:

```
BoxPlot = LBSelectSplit << Graph Builder(
Size( 1199, 762 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables(
X(
:Visit Name,
Order By( :Visit Number, Ascending, Order Statistic( "Mean" ) )
),
Y( :Alanine Aminotransferase )
),
Elements( Box Plot( X, Y, Legend( 6 ) ) ),
Column Switcher(
:Alanine Aminotransferase,
{:Alanine Aminotransferase, :Albumin, :Alkaline Phosphatase, :Amylase,
:Aspartate Aminotransferase, :Bilirubin, :C Reactive Protein, :Calcitonin,
:Calcium, :Cholesterol, :Creatine Kinase, :Creatinine, :Eosinophils,
:Erythrocytes, :Gamma Glutamyl Transferase,
:Name( "Glomerular Filtration Rate, Estimated" ), :HDL Cholesterol,
:Hematocrit, :Hemoglobin, :Hemoglobin A1C, :LDL Cholesterol, :Leukocytes,
:Lipase, :Lymphocytes, :Monocytes, :Neutrophils, :Platelets, :Potassium,
:Sodium, :Triglycerides, :Urea, :VLDL Cholesterol}
)
);
MeanPlot = LBSelectSplit << Graph Builder(
Size( 1181, 745 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Fit to Window( "Maintain Aspect Ratio" ),
Variables(
X(
:Visit Name,
Order By( :Visit Number, Ascending, Order Statistic( "Mean" ) )
),
Y( :Alanine Aminotransferase )
),
Elements( Line( X, Y, Legend( 6 ), Error Bars( "Standard Error" ) ) ),
Column Switcher(
:Alanine Aminotransferase,
{:Alanine Aminotransferase, :Albumin, :Alkaline Phosphatase, :Amylase,
:Aspartate Aminotransferase, :Bilirubin, :C Reactive Protein, :Calcitonin,
:Calcium, :Cholesterol, :Creatine Kinase, :Creatinine, :Eosinophils,
:Erythrocytes, :Gamma Glutamyl Transferase,
:Name( "Glomerular Filtration Rate, Estimated" ), :HDL Cholesterol,
:Hematocrit, :Hemoglobin, :Hemoglobin A1C, :LDL Cholesterol, :Leukocytes,
:Lipase, :Lymphocytes, :Monocytes, :Neutrophils, :Platelets, :Potassium,
:Sodium, :Triglycerides, :Urea, :VLDL Cholesterol}
)
);
New Window("Select Lab Surveillance", CombinedGraphWindow = V List Box());
CombinedGraphWindow << append(Report(MeanPlot)) << append(Report(BoxPlot));
```

But the column switchers are not included in the new window. I know that one column switcher wont be able to "cover" both graphs so I want one for each graph just like when the graphs are in two separate windows. How can that be done?

Br Julie

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

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

It isn't wrong but it isn't necessary, as far as I can tell, to use the append capability of a display box here. New Window() can use the results from the assignment of Graph Builder to make the window on its own. This way makes for simpler, cleaner code, in my opinion.

```
New Window( "Select Lab Surveillance",
MeanPlot = LBSelectSplit << Graph Builder(
Size( 1181, 745 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Fit to Window( "Maintain Aspect Ratio" ),
Variables(
X( :Visit Name, Order By( :Visit Number, Ascending, Order Statistic( "Mean" ) ) ),
Y( :Alanine Aminotransferase )
),
Elements( Line( X, Y, Legend( 6 ), Error Bars( "Standard Error" ) ) ),
Column Switcher(
:Alanine Aminotransferase,
{:Alanine Aminotransferase, :Albumin, :Alkaline Phosphatase, :Amylase, :Aspartate Aminotransferase,
:Bilirubin, :C Reactive Protein, :Calcitonin, :Calcium, :Cholesterol, :Creatine Kinase,
:Creatinine, :Eosinophils, :Erythrocytes, :Gamma Glutamyl Transferase,
:Name( "Glomerular Filtration Rate, Estimated" ), :HDL Cholesterol, :Hematocrit, :Hemoglobin,
:Hemoglobin A1C, :LDL Cholesterol, :Leukocytes, :Lipase, :Lymphocytes, :Monocytes, :Neutrophils,
:Platelets, :Potassium, :Sodium, :Triglycerides, :Urea, :VLDL Cholesterol}
)
),
BoxPlot = LBSelectSplit << Graph Builder(
Size( 1199, 762 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables(
X( :Visit Name, Order By( :Visit Number, Ascending, Order Statistic( "Mean" ) ) ),
Y( :Alanine Aminotransferase )
),
Elements( Box Plot( X, Y, Legend( 6 ) ) ),
Column Switcher(
:Alanine Aminotransferase,
{:Alanine Aminotransferase, :Albumin, :Alkaline Phosphatase, :Amylase, :Aspartate Aminotransferase,
:Bilirubin, :C Reactive Protein, :Calcitonin, :Calcium, :Cholesterol, :Creatine Kinase,
:Creatinine, :Eosinophils, :Erythrocytes, :Gamma Glutamyl Transferase,
:Name( "Glomerular Filtration Rate, Estimated" ), :HDL Cholesterol, :Hematocrit, :Hemoglobin,
:Hemoglobin A1C, :LDL Cholesterol, :Leukocytes, :Lipase, :Lymphocytes, :Monocytes, :Neutrophils,
:Platelets, :Potassium, :Sodium, :Triglycerides, :Urea, :VLDL Cholesterol}
)
)
);
```

Learn it once, use it forever!

3 REPLIES 3

Highlighted
##

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

Re: Combining two graphs in one window

Forgot the data table

Highlighted
##

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

Re: Combining two graphs in one window

If you look at what does end up in the combined window, you will see that it is only a copy of the Graph Builder display, and that it has no ability to change etc.

What you need to do, is to append the actual code for the graph builders into the display window....something like:

```
New Window( "Select Lab Surveillance", CombinedGraphWindow = V List Box() );
CombinedGraphWindow << append(
MeanPlot = LBSelectSplit << Graph Builder(
Size( 1181, 745 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Fit to Window( "Maintain Aspect Ratio" ),
Variables(
X( :Visit Name, Order By( :Visit Number, Ascending, Order Statistic( "Mean" ) ) ),
Y( :Alanine Aminotransferase )
),
Elements( Line( X, Y, Legend( 6 ), Error Bars( "Standard Error" ) ) ),
Column Switcher(
:Alanine Aminotransferase,
{:Alanine Aminotransferase, :Albumin, :Alkaline Phosphatase, :Amylase, :Aspartate Aminotransferase,
:Bilirubin, :C Reactive Protein, :Calcitonin, :Calcium, :Cholesterol, :Creatine Kinase,
:Creatinine, :Eosinophils, :Erythrocytes, :Gamma Glutamyl Transferase,
:Name( "Glomerular Filtration Rate, Estimated" ), :HDL Cholesterol, :Hematocrit, :Hemoglobin,
:Hemoglobin A1C, :LDL Cholesterol, :Leukocytes, :Lipase, :Lymphocytes, :Monocytes, :Neutrophils,
:Platelets, :Potassium, :Sodium, :Triglycerides, :Urea, :VLDL Cholesterol}
)
)
) << append(
BoxPlot = LBSelectSplit << Graph Builder(
Size( 1199, 762 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables(
X( :Visit Name, Order By( :Visit Number, Ascending, Order Statistic( "Mean" ) ) ),
Y( :Alanine Aminotransferase )
),
Elements( Box Plot( X, Y, Legend( 6 ) ) ),
Column Switcher(
:Alanine Aminotransferase,
{:Alanine Aminotransferase, :Albumin, :Alkaline Phosphatase, :Amylase, :Aspartate Aminotransferase,
:Bilirubin, :C Reactive Protein, :Calcitonin, :Calcium, :Cholesterol, :Creatine Kinase,
:Creatinine, :Eosinophils, :Erythrocytes, :Gamma Glutamyl Transferase,
:Name( "Glomerular Filtration Rate, Estimated" ), :HDL Cholesterol, :Hematocrit, :Hemoglobin,
:Hemoglobin A1C, :LDL Cholesterol, :Leukocytes, :Lipase, :Lymphocytes, :Monocytes, :Neutrophils,
:Platelets, :Potassium, :Sodium, :Triglycerides, :Urea, :VLDL Cholesterol}
)
)
);
```

Jim

Highlighted

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

It isn't wrong but it isn't necessary, as far as I can tell, to use the append capability of a display box here. New Window() can use the results from the assignment of Graph Builder to make the window on its own. This way makes for simpler, cleaner code, in my opinion.

```
New Window( "Select Lab Surveillance",
MeanPlot = LBSelectSplit << Graph Builder(
Size( 1181, 745 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Fit to Window( "Maintain Aspect Ratio" ),
Variables(
X( :Visit Name, Order By( :Visit Number, Ascending, Order Statistic( "Mean" ) ) ),
Y( :Alanine Aminotransferase )
),
Elements( Line( X, Y, Legend( 6 ), Error Bars( "Standard Error" ) ) ),
Column Switcher(
:Alanine Aminotransferase,
{:Alanine Aminotransferase, :Albumin, :Alkaline Phosphatase, :Amylase, :Aspartate Aminotransferase,
:Bilirubin, :C Reactive Protein, :Calcitonin, :Calcium, :Cholesterol, :Creatine Kinase,
:Creatinine, :Eosinophils, :Erythrocytes, :Gamma Glutamyl Transferase,
:Name( "Glomerular Filtration Rate, Estimated" ), :HDL Cholesterol, :Hematocrit, :Hemoglobin,
:Hemoglobin A1C, :LDL Cholesterol, :Leukocytes, :Lipase, :Lymphocytes, :Monocytes, :Neutrophils,
:Platelets, :Potassium, :Sodium, :Triglycerides, :Urea, :VLDL Cholesterol}
)
),
BoxPlot = LBSelectSplit << Graph Builder(
Size( 1199, 762 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables(
X( :Visit Name, Order By( :Visit Number, Ascending, Order Statistic( "Mean" ) ) ),
Y( :Alanine Aminotransferase )
),
Elements( Box Plot( X, Y, Legend( 6 ) ) ),
Column Switcher(
:Alanine Aminotransferase,
{:Alanine Aminotransferase, :Albumin, :Alkaline Phosphatase, :Amylase, :Aspartate Aminotransferase,
:Bilirubin, :C Reactive Protein, :Calcitonin, :Calcium, :Cholesterol, :Creatine Kinase,
:Creatinine, :Eosinophils, :Erythrocytes, :Gamma Glutamyl Transferase,
:Name( "Glomerular Filtration Rate, Estimated" ), :HDL Cholesterol, :Hematocrit, :Hemoglobin,
:Hemoglobin A1C, :LDL Cholesterol, :Leukocytes, :Lipase, :Lymphocytes, :Monocytes, :Neutrophils,
:Platelets, :Potassium, :Sodium, :Triglycerides, :Urea, :VLDL Cholesterol}
)
)
);
```

Learn it once, use it forever!

Article Labels

There are no labels assigned to this post.