3

After plotting the figure, I want to copy it to the clipbaoard instead of saving to figures. I searched the internet and the code does not work, either the required modules only support python 2.x or the program stopped by not well-defined functions.

I am using Python 3.6 in Windows 10. My matplotlib version is 2.0.2. I tried 'PyGTK: copy matplotlib figure to clipboard'

and got the error: ImportError: Gtk* backend requires pygtk to be installed. I then visited www.pygtk.org/downloads.html to download pygtk/PyGObject (Windows) but it requires python 2.6 or file not found.

Can anyone show how to achieve it?

import matplotlib.pyplot as plt
a = [2,3,6,7,1]
plt.plot(a)
plt.show()
Frankie
  • 744
  • 1
  • 9
  • 14
  • Please add some links to the solutions you have tried, for example why did this (https://stackoverflow.com/questions/10635537/pygtk-copy-matplotlib-figure-to-clipboard#10637021) not work? Which backend are you using? which version of Python, matplotlib and Linux/Windows? – Ed Smith Nov 28 '17 at 08:18
  • Could this help? I don't think you can actually do it in a simple way without external libraries. https://gist.github.com/urbushey/1702408 – user1620443 Nov 28 '17 at 08:51
  • It will depend on your backend, for QT backend, see [this answer](https://stackoverflow.com/questions/31607458/how-to-add-clipboard-support-to-matplotlib-figures). – ImportanceOfBeingErnest Nov 28 '17 at 10:43

0 Answers0