<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic using a variable as column name when creating a plot in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/using-a-variable-as-column-name-when-creating-a-plot/m-p/919101#M107840</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-jsl"&gt;The script below loads some data and should create twice the same plot.&lt;BR /&gt;The first one by referring to the column name by using a variable (test1), &lt;/CODE&gt;&lt;CODE class=" language-jsl"&gt;the second one&amp;nbsp;by&amp;nbsp;calling&amp;nbsp;the&amp;nbsp;column&amp;nbsp;name&amp;nbsp;directly.&amp;nbsp;&lt;/CODE&gt;&lt;BR /&gt;The second one works fine, but for the first one I get an empty plot area. I guess there is a problem with how I define or call test1. I have tried different approaches, but so far nothing worked.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// Import the Excel file with specified settings
dt = Open(
    "/Y:/.../file.xlsx",
    Worksheets( "Pivot table for JMP" ),
    Worksheet Settings(
        1,
        Has Column Headers( 1 ),
        Headers Start on Row( 2 ),
        Data Starts on Row( 3 )
    )
);

// Filter rows to include only "AAA" in "Common Designation"
dt_AAA = dt &amp;lt;&amp;lt; Subset(
    Rows( :Common Designation == "AAA" ),
    Include All Columns,
    Name( "Filtered AAA" )
);

size = "AAA" ;

Match( size,
	"AAA", test1 =  column ("PL (min)"),
);

New Window( size,
	
	V List Box(
		Graph Builder(
			Size( 500, 297 ),
			Show Control Panel( 0 ),
			Variables( X( :test1 ), Y( :Chemistry ), Color( :Chemistry ) ),
			Elements( Points( X, Y, Legend( 106 ) ) )
		),
		Graph Builder(
			Size( 500, 297 ),
			Show Control Panel( 0 ),
			Variables( X( :"PL (min)"n ), Y( :Chemistry ), Color( :Chemistry ) ),
			Elements( Points( X, Y, Legend( 106 ) ) )
		),
	),
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Dec 2025 14:55:08 GMT</pubDate>
    <dc:creator>matthias_bruchh</dc:creator>
    <dc:date>2025-12-12T14:55:08Z</dc:date>
    <item>
      <title>using a variable as column name when creating a plot</title>
      <link>https://community.jmp.com/t5/Discussions/using-a-variable-as-column-name-when-creating-a-plot/m-p/919101#M107840</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-jsl"&gt;The script below loads some data and should create twice the same plot.&lt;BR /&gt;The first one by referring to the column name by using a variable (test1), &lt;/CODE&gt;&lt;CODE class=" language-jsl"&gt;the second one&amp;nbsp;by&amp;nbsp;calling&amp;nbsp;the&amp;nbsp;column&amp;nbsp;name&amp;nbsp;directly.&amp;nbsp;&lt;/CODE&gt;&lt;BR /&gt;The second one works fine, but for the first one I get an empty plot area. I guess there is a problem with how I define or call test1. I have tried different approaches, but so far nothing worked.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// Import the Excel file with specified settings
dt = Open(
    "/Y:/.../file.xlsx",
    Worksheets( "Pivot table for JMP" ),
    Worksheet Settings(
        1,
        Has Column Headers( 1 ),
        Headers Start on Row( 2 ),
        Data Starts on Row( 3 )
    )
);

// Filter rows to include only "AAA" in "Common Designation"
dt_AAA = dt &amp;lt;&amp;lt; Subset(
    Rows( :Common Designation == "AAA" ),
    Include All Columns,
    Name( "Filtered AAA" )
);

size = "AAA" ;

Match( size,
	"AAA", test1 =  column ("PL (min)"),
);

New Window( size,
	
	V List Box(
		Graph Builder(
			Size( 500, 297 ),
			Show Control Panel( 0 ),
			Variables( X( :test1 ), Y( :Chemistry ), Color( :Chemistry ) ),
			Elements( Points( X, Y, Legend( 106 ) ) )
		),
		Graph Builder(
			Size( 500, 297 ),
			Show Control Panel( 0 ),
			Variables( X( :"PL (min)"n ), Y( :Chemistry ), Color( :Chemistry ) ),
			Elements( Points( X, Y, Legend( 106 ) ) )
		),
	),
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2025 14:55:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/using-a-variable-as-column-name-when-creating-a-plot/m-p/919101#M107840</guid>
      <dc:creator>matthias_bruchh</dc:creator>
      <dc:date>2025-12-12T14:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: using a variable as column name when creating a plot</title>
      <link>https://community.jmp.com/t5/Discussions/using-a-variable-as-column-name-when-creating-a-plot/m-p/919145#M107842</link>
      <description>&lt;P&gt;If I'm understanding correctly, I think you just need to remove the colon in front of test1 in the first Graph Builder script. Here's an example script that works:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here (1);
dt = open ("$SAMPLE_DATA/big class.jmp");
test1 = column ("weight");

Graph Builder (
	Variables (X(test1), Y(:height), color (:sex))
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Dec 2025 15:33:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/using-a-variable-as-column-name-when-creating-a-plot/m-p/919145#M107842</guid>
      <dc:creator>Jed_Campbell</dc:creator>
      <dc:date>2025-12-12T15:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: using a variable as column name when creating a plot</title>
      <link>https://community.jmp.com/t5/Discussions/using-a-variable-as-column-name-when-creating-a-plot/m-p/919178#M107844</link>
      <description>&lt;P&gt;A cool trick to find bugs like this:&lt;BR /&gt;remove more and more lines from the buggy script. Till there are just enough lines to produce the error.&lt;BR /&gt;important: the code should contain all ingredients to produce the error - for everybody who executes the code *)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This has 2 advantages:&lt;BR /&gt;- in most of the cases, one finds the bug automatically. 1 line removed, the bug is gone.&lt;/P&gt;
&lt;P&gt;- the remaining code is very short, this makes it much easier to find the bug.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*) on my system, it crashed with the error message:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1765563090008.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/88790iEF066D36CD78E560/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1765563090008.png" alt="hogi_0-1765563090008.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;much better: use one of the sample files, like in&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/610"&gt;@Jed_Campbell&lt;/a&gt;&amp;nbsp;'s example.&lt;BR /&gt;This has another benefit: you can differentiate between:&lt;BR /&gt;- there is an error in my data table (and the error is gone with the example data)&lt;BR /&gt;- there is an error in my script (because I can reproduce the error with the sample data)&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2025 18:13:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/using-a-variable-as-column-name-when-creating-a-plot/m-p/919178#M107844</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-12-12T18:13:50Z</dc:date>
    </item>
  </channel>
</rss>

