Ask Your Question

matplotlib x11 window

asked 2013-04-24 14:28:01 +0200

kjlvcxzoiperwq gravatar image

updated 2013-05-11 15:45:39 +0200

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 15:13:45 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-04-24 21:09:15 +0200

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 12:25:04 +0200 )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 13:13:44 +0200 )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 14:28:01 +0200

Seen: 1,175 times

Last updated: Apr 24 '13