First, from the documentation in the Scripting Index, Syntax: image = Python Get Graphics( format );
There is no second parameter. The scripting index description states: Returns the last graphics object written to the Python graph display window in a graphics format specified by the format parameter.
Second, You must be using JMP prior to JMP 18.
Python Get Graphics(png); was deprecated in 18, and already removed from JMP 19 development builds. In JMP 18 it does not return a value, but instead raises an Alert dialog. The appropriate way which will across all versions of JMP, is to have the Python code save the image to a file. Then Open() the file and hand that off off to a JSL Picture Box(). JMP 18's scripting index for Python Get Graphics() gives a complete example of the workaround.
Instead of doing a plt.show()
you should do:
# save image to location of your choosing
plt.savefig( jmp.TEMP + 'get_graphics_img.png') # JMP 18+
# or ... savefig( '/tmp/get_graphics_img.png') before JMP 18 (macOS).
Then from JSL: or via jmp.run_jsl(''' ... '''') from Python
// plot = Python Get Graphics( png ); // DEPRECATED
pngJMP = New Window( "Plot", Picture Box( Open( "$TEMP/get_graphics_img.png", png ) ) );
Python Submit( "plt.close()" );
rc = Delete File( "$TEMP/get_graphics_img.png" );
There is another issue. Especially if running on the Mac, matplotlib and JMP fight for control over the window event loop if matplotlib is brought up interactively. You can get an exit of JMP by closing the last matplotlib window visible on screen. This depends on the matplotlib backend, but it's especially finicky on macOS.