def _fix_matplotlib_crash():
    "Set Matplotlib backend to avoid a crash.\n\n    The default Matplotlib backend crashes Python on OSX when run on a thread\n    that's not the main thread, so here we set a safer backend as a fix.\n    Users can always disable this behavior by setting the config\n    runner.fixMatplotlib = false.\n\n    This fix is OS-independent. We didn't see a good reason to make this\n    Mac-only. Consistency within Streamlit seemed more important.\n    "
    if config.get_option('runner.fixMatplotlib'):
        try:
            import matplotlib
            matplotlib.use('Agg')
        except ImportError:
            pass
Set Matplotlib backend to avoid a crash.

The default Matplotlib backend crashes Python on OSX when run on a thread
that's not the main thread, so here we set a safer backend as a fix.
Users can always disable this behavior by setting the config
runner.fixMatplotlib = false.

This fix is OS-independent. We didn't see a good reason to make this
Mac-only. Consistency within Streamlit seemed more important.
def _fix_matplotlib_crash():
    "Set Matplotlib backend to avoid a crash.\n\n    The default Matplotlib backend crashes Python on OSX when run on a thread\n    that's not the main thread, so here we set a safer backend as a fix.\n    Users can always disable this behavior by setting the config\n    runner.fixMatplotlib = false.\n\n    This fix is OS-independent. We didn't see a good reason to make this\n    Mac-only. Consistency within Streamlit seemed more important.\n    "
    if config.get_option('runner.fixMatplotlib'):
        try:
            import matplotlib
            matplotlib.use('Agg')
        except ImportError:
            pass