The following program does not work on non-GUI environments.
I want to let this program save the figure to a temporary png file when plt.show is called.
import matplotlib.pyplot as plt
plt.scatter(2,3)
plt.scatter(4,5)
plt.show()
I know that this can be resolved by using plt.savefig instead of plt.show (cf. Save plot to image file instead of displaying it using Matplotlib) . But I don't want to change the program itself. The program may be given by other user who may familiar with using matplotlib in GUI environments.
So I consider to change the backend of matplotlib into my own backend which changes behavior of show. It can be done by changing matplotlibrc.
But the document about backend only explains how to select "built-in" backends:
https://matplotlib.org/faq/usage_faq.html?highlight=backend#coding-styles
The document says that backend can be specified as module://my_backend, but it does not define the "interface" of my_backend ( what kind of Classes/Object should be implemented in which names? )
Is there any documents which explains the interface of backends? (Or some other workaround change behavior of show?)
 
     
     
    