RiboCode icon indicating copy to clipboard operation
RiboCode copied to clipboard

Generating figures with matplotlib when DISPLAY variable is undefined or invalid

Open zhengtaoxiao opened this issue 7 years ago • 0 comments

When running the "metaplots" or "plot_orf_density" command, some users received errors similar to the following:

"raise RuntimeError('Invalid DISPLAY variable')" _"tkinter.TclError: no display name and no $DISPLAY environment variable"

The main problem is that default backend of matplotlib is unavailable. The solution is to modify the backend. A very simple solution is to set the MPLBACKEND environment variable, either for your current shell or for a single script:

export MPLBACKEND="module://my_backend"

Giving below are non-interactive backends, capable of writing to a file:

  • Agg
  • PS
  • PDF
  • SVG
  • Cairo
  • GDK

See also: http://matplotlib.org/faq/usage_faq.html#what-is-a-backend http://matplotlib.org/users/customizing.html#the-matplotlibrc-file http://stackoverflow.com/questions/2801882/generating-a-png-with-matplotlib-when-display-is-undefined

zhengtaoxiao avatar May 03 '17 07:05 zhengtaoxiao