Ask Your Question

matplotlib x11 window

asked 2013-04-24 07:28:01 -0500

kjlvcxzoiperwq gravatar image

updated 2013-05-11 08:45:39 -0500

vdelecroix gravatar image

In both Ipython and Python terminals I can type in the following

import matplotlib.pyplot as plt
plt.ylabel('some numbers')

and a nice x11 figure will pop up (example figure is shown at In sage, the statement just does nothing. Is there any way to make this work in sage? It is kindof neat at times that sage plotting functions just dump an image file and then launches an image viewer, but I need more primitive access to matplotlib sometimes and I also need to be able to interact with the figure sometimes. Why doesn't this work in the sage terminal?

edit retag flag offensive close merge delete


I confirm that it does work with my native Python and IPython. But it does not work with neither Python or IPython packed with Sage (obtained from the command line with "sage -python" or "sage -ipython")...

vdelecroix gravatar imagevdelecroix ( 2013-04-24 08:13:45 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-04-24 14:09:15 -0500

Jesustc gravatar image

For the cases in which you don't need interactivity, you can just change your

by a


If you really want interactivity, you may find this wiki page useful (I haven't tried it myself, I must say).

edit flag offensive delete link more


plt.savefig('') didn't do anything, and i tried everything on the link you provided, and that also didn't do anything.

kjlvcxzoiperwq gravatar imagekjlvcxzoiperwq ( 2013-04-25 05:25:04 -0500 )edit

Sorry, maybe I didn't understand it completely: do you want to do it from the command line or from the notebook? In the notebook, the savefig('') should work, while in the command line, in the worst case, you can always save the plot to a file and see it in any image viewer, with plt.savefig('some_path_and_file_name'). As for the wiki page, as I told you, I haven't tried it myself. Why don't you try to post the errors you get in the sage-support mailing list? (

Jesustc gravatar imageJesustc ( 2013-04-25 06:13:44 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-04-24 07:28:01 -0500

Seen: 776 times

Last updated: Apr 24 '13