cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New to using JMP? Hit the ground running with the Early User Edition of Discovery Summit. Register now, free of charge.
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
HydroBug
Level II

When exporting graph as image the background of the graph box remains white even when set as "transparent" in the report preferences.

Hello all -

I am working with JMP Pro 16.1.0. When exporting my graph as an image file, the background of the graph box remains white even when I have set the background as "transparent" in the report preferences.  Below is an example when I exported an SVG file: the titles and axes export as transparent, but the graph box continues as white. 

Capture4.PNG

I tried exporting as various types of image files in happens for all of them.  Is there a workaround?

Thank you all!

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: When exporting graph as image the background of the graph box remains white even when set as "transparent" in the report preferences.

Also, since you are using svg, you can edit the svg after it is written to remove the rect fills. For some reason, there are two. You could use a text editor, or use JSL to do it:

dt = Open( "$sample_data/big class.jmp" );
g = dt << Graph Builder(
	Show Control Panel( 0 ),
	Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
	Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);
Report( g ) << savepicture( "f:/g1.svg", "svg" );
Open( "f:/g1.svg" );
txt = Load Text File( "f:/g1.svg" );
/* remove the rect fill
<g fill="#DDDDDD">
 <rect stroke="none" x="84.5" y="36.5" width="500" height="409" />
</g>
*/

While(
	Pat Match( txt,
		("<g fill=" + Pat Break( ">" ) + ">" + Pat Span( " \!n\!r" ) + "<rect stroke=" + Pat Break( ">" ) + ">" + Pat Span( " \!n\!r" ) + "</g>") >> deleted,
		""
	),
	Show( deleted )
);

Open( Save Text File( "f:/g2.svg", txt ) );

g2.svg

 

Craige

View solution in original post

3 REPLIES 3
Craige_Hales
Super User

Re: When exporting graph as image the background of the graph box remains white even when set as "transparent" in the report preferences.

Vote for my wish: Transparent background color for graphs 

Craige
Craige_Hales
Super User

Re: When exporting graph as image the background of the graph box remains white even when set as "transparent" in the report preferences.

Also, since you are using svg, you can edit the svg after it is written to remove the rect fills. For some reason, there are two. You could use a text editor, or use JSL to do it:

dt = Open( "$sample_data/big class.jmp" );
g = dt << Graph Builder(
	Show Control Panel( 0 ),
	Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
	Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);
Report( g ) << savepicture( "f:/g1.svg", "svg" );
Open( "f:/g1.svg" );
txt = Load Text File( "f:/g1.svg" );
/* remove the rect fill
<g fill="#DDDDDD">
 <rect stroke="none" x="84.5" y="36.5" width="500" height="409" />
</g>
*/

While(
	Pat Match( txt,
		("<g fill=" + Pat Break( ">" ) + ">" + Pat Span( " \!n\!r" ) + "<rect stroke=" + Pat Break( ">" ) + ">" + Pat Span( " \!n\!r" ) + "</g>") >> deleted,
		""
	),
	Show( deleted )
);

Open( Save Text File( "f:/g2.svg", txt ) );

g2.svg

 

Craige
HydroBug
Level II

Re: When exporting graph as image the background of the graph box remains white even when set as "transparent" in the report preferences.

Oh WOW Craige - This works fabulously!  Thank you, thank you!

It also go rid of the grid in between frame boxes, but I managed to get them to show up gain.  Thank you, thank you, this is hugely helpful.

-Erika.