<?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 Re: Scripting Y Axis to be Log scale in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Scripting-Y-Axis-to-be-Log-scale/m-p/54692#M30914</link>
    <description>&lt;P&gt;I like to use XPath(). A single message applies to all objects found. See the last 2 lines of the script below.&amp;nbsp; Ther is a section and sample scripts for Xpath() and Find() in Chapter 6 of the 2nd edition of JSL Companion. You can find a simple example in the Scripting Index &amp;gt;Display Box &amp;gt; search for xpath.&amp;nbsp; To learn more about XPath syntax and functions, click&amp;nbsp;&lt;A href="https://www.tutorialspoint.com/xpath/xpath_quick_guide.htm" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;&lt;A href="https://www.tutorialspoint.com/xpath/xpath_quick_guide.htm" target="_blank"&gt;https://www.tutorialspoint.com/xpath/xpath_quick_guide.htm&lt;/A&gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;gb = Graph Builder(
        Show Control Panel( 0 ),
	Variables( X( :Chemical Compound ), Y( :Data ), Page( :SampleID ) ),
	Elements( Bar( X, Y, Legend( 10 ) ) ),
	SendToReport(
//			Dispatch(
//			{},
//			"Data",
//			ScaleBox (2),
//			{Scale( "Log" ), Format( "Best", 10 ), Min( 0.01 ), Max( 80 ), Inc( 1 ),
//			Minor Ticks( 1 )}
//		),
		Dispatch( {}, "400", LegendBox, {Set Title( "" )} ),
	)
);

xx =gb &amp;lt;&amp;lt; Xpath( "//ScaleBox[@charID='Data']");

xx &amp;lt;&amp;lt; {Scale( "Log" ), Format( "Best", 10 ), Min( 0.01 ), Max( 80 ), Inc( 1 ), Minor Ticks(1) };

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Apr 2018 12:27:33 GMT</pubDate>
    <dc:creator>gzmorgan0</dc:creator>
    <dc:date>2018-04-09T12:27:33Z</dc:date>
    <item>
      <title>Scripting Y Axis to be Log scale</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-Y-Axis-to-be-Log-scale/m-p/54573#M30852</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have script to make multiple histograms using stacked data. The y-axis used in the histogram is the stacked data column :Data, the x-axis used in the histogram is the stacked data column labels :Chemical Compound. Then I use Page (:Sample ID) to separate my graphs into one&amp;nbsp;graph per sample. Depending on my dataset that I'm using the script for, I may have 2 samples, or 100 samples. My graphs work fine, however, I would like the y-axis to be in log scale. I've tried multiple ways of inserting code to do this, however, the most I've gotten to work is 1 graph in log scale, while the others are all linear. I've attached the code. The part that is sort of working is the 'ScaleBox (2),'.&amp;nbsp;It changes the first graph to log, however, it&amp;nbsp;leaves the remaining scales as linear. If I change the (2) to a (3) after 'ScaleBox' then the second graph in the group changes to log while the others remain linear. If I remove the (#) after 'ScaleBox' altogether, then none go to log. I've also tried inserting 'Left Y Log Scale (1)' into the Variables area but nothing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attached a dataset to run with the script. Any help with this would be appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Graph Builder(
        Show Control Panel( 0 ),
	Variables( X( :Chemical Compound ), Y( :Data ), Page( :SampleID ) ),
	Elements( Bar( X, Y, Legend( 10 ) ) ),
	SendToReport(
			Dispatch(
			{},
			"Data",
			ScaleBox (2),
			{Scale( "Log" ), Format( "Best", 10 ), Min( 0.01 ), Max( 80 ), Inc( 1 ),
			Minor Ticks( 1 )}
		),
		Dispatch( {}, "400", LegendBox, {Set Title( "" )} ),
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Apr 2018 19:26:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-Y-Axis-to-be-Log-scale/m-p/54573#M30852</guid>
      <dc:creator>Lharbicht</dc:creator>
      <dc:date>2018-04-06T19:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Y Axis to be Log scale</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-Y-Axis-to-be-Log-scale/m-p/54580#M30857</link>
      <description>&lt;P&gt;Unfortunately you have to send the log Y axis message to each graph page.&amp;nbsp; This code works but shows errors in the log.&amp;nbsp; Hope someone has a cleaner solution for you.&lt;/P&gt;
&lt;P&gt;EDIT 4-9-2018 I was looping over id_list and not unique_values.&amp;nbsp; Fixed code is below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Get_unique_values = Function( {in_list},
      {Default Local}, 
      tmp = [=&amp;gt; 0]; 
      Insert Into( tmp, in_list ); 
      tmp &amp;lt;&amp;lt; get keys; 
); 

dt = data table("Test Data");

id_list = column(dt, "Sample ID") &amp;lt;&amp;lt; get values;
unique_values = get_unique_values(id_list);

gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size( 530, 1460 ),
	Show Control Panel( 0 ),
	Variables( X( :Chemical Compound ), Y( :Data ), Page( :Sample ID ) ),
	Elements( Bar( X, Y, Legend( 10 ) ) ),
);

for (i = 1, i &amp;lt;= nitems(unique_values), i++,
	gb &amp;lt;&amp;lt; SendToReport(
		Dispatch( {}, "Data", ScaleBox( i + 1 ),
			{Scale( "Log" ), Format( "Best", 10 )}
		)
	);
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 12:20:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-Y-Axis-to-be-Log-scale/m-p/54580#M30857</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2018-04-09T12:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Y Axis to be Log scale</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-Y-Axis-to-be-Log-scale/m-p/54692#M30914</link>
      <description>&lt;P&gt;I like to use XPath(). A single message applies to all objects found. See the last 2 lines of the script below.&amp;nbsp; Ther is a section and sample scripts for Xpath() and Find() in Chapter 6 of the 2nd edition of JSL Companion. You can find a simple example in the Scripting Index &amp;gt;Display Box &amp;gt; search for xpath.&amp;nbsp; To learn more about XPath syntax and functions, click&amp;nbsp;&lt;A href="https://www.tutorialspoint.com/xpath/xpath_quick_guide.htm" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;&lt;A href="https://www.tutorialspoint.com/xpath/xpath_quick_guide.htm" target="_blank"&gt;https://www.tutorialspoint.com/xpath/xpath_quick_guide.htm&lt;/A&gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;gb = Graph Builder(
        Show Control Panel( 0 ),
	Variables( X( :Chemical Compound ), Y( :Data ), Page( :SampleID ) ),
	Elements( Bar( X, Y, Legend( 10 ) ) ),
	SendToReport(
//			Dispatch(
//			{},
//			"Data",
//			ScaleBox (2),
//			{Scale( "Log" ), Format( "Best", 10 ), Min( 0.01 ), Max( 80 ), Inc( 1 ),
//			Minor Ticks( 1 )}
//		),
		Dispatch( {}, "400", LegendBox, {Set Title( "" )} ),
	)
);

xx =gb &amp;lt;&amp;lt; Xpath( "//ScaleBox[@charID='Data']");

xx &amp;lt;&amp;lt; {Scale( "Log" ), Format( "Best", 10 ), Min( 0.01 ), Max( 80 ), Inc( 1 ), Minor Ticks(1) };

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 12:27:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-Y-Axis-to-be-Log-scale/m-p/54692#M30914</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2018-04-09T12:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Y Axis to be Log scale</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-Y-Axis-to-be-Log-scale/m-p/54693#M30915</link>
      <description>&lt;P&gt;I didn't realize xpath could be used for this.&amp;nbsp; Nice clean solution!&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 12:30:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-Y-Axis-to-be-Log-scale/m-p/54693#M30915</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2018-04-09T12:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Y Axis to be Log scale</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-Y-Axis-to-be-Log-scale/m-p/54797#M30969</link>
      <description>&lt;P&gt;Thank you for this solution! I will checkinto this some more.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 19:42:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-Y-Axis-to-be-Log-scale/m-p/54797#M30969</guid>
      <dc:creator>Lharbicht</dc:creator>
      <dc:date>2018-04-10T19:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Y Axis to be Log scale</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-Y-Axis-to-be-Log-scale/m-p/69217#M35025</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been using this solution for my log scale graphing needs. It works great. However, if I want to graph a large number of samples (say &amp;gt; 50) it gives an error&amp;nbsp;(see below). Has anyone run into this before? I've tried adding 'wait();' before and after and in different areas thinking my code just needed more time. It works fine for &amp;lt; 50 samples, anything above gives the error.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Excessive depth in document: 256 use XML_PARSE_HUGE option&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;in access or evaluation of 'Xpath' , Xpath( "//ScaleBox[@charID='Rel TEQ']" ) /*###*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtstacked3:Parameter3 &amp;lt;&amp;lt; set property( "Row Order Levels", 1 );
dtstacked3:Sample ID &amp;lt;&amp;lt; set property ("Row Order Levels",1);
gb3 = dtstacked3 &amp;lt;&amp;lt; Graph Builder(
	Show Control Panel( 0 ),
	Variables( X( :Parameter3 ), Y( :Rel TEQ ), Page( :Sample ID ), Color( :Rel TEQ 2 ) ),
	Elements( Bar( X, Y, Legend( 6 ) ) ),
	SendToReport(
		Dispatch( {}, "400", ScaleBox, {Legend Model( 6, Properties( 0, {gradient(
						{Color Theme(
							{"Paired Copy 2 2502", 8193, {{254, 207, 132}, {254, 207,
							132}, {254, 207, 132}, {254, 207, 132}, {254, 207, 132},
							{254, 207, 132}, {114, 171, 187}, {114, 171, 187}, {114,
							171, 187}, {114, 171, 187}, {114, 171, 187}}}
						), Scale Values( [0 1] ), Width( 12 ), Discrete Colors( 1 )}
					)}) )} ),
		Dispatch( {}, "400", LegendBox, {Set Title( "" )} )
	)
);

xx3 = gb3 &amp;lt;&amp;lt; Xpath("//ScaleBox[@charID='Rel TEQ']");
xx3 &amp;lt;&amp;lt; {Scale("Log"), Format("Best", 10), Min(0.1), Max(80), Inc(1), Minor Ticks(1)};

gb3 &amp;lt;&amp;lt; on close( Close( dtstacked3, nosave ) );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lacey&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 18:39:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-Y-Axis-to-be-Log-scale/m-p/69217#M35025</guid>
      <dc:creator>Lharbicht</dc:creator>
      <dc:date>2018-08-22T18:39:28Z</dc:date>
    </item>
  </channel>
</rss>

