Ask Your Question

how to produce graphics from cli

asked 2016-01-11 19:57:10 +0200

alienfetuseater gravatar image

updated 2016-01-11 23:30:11 +0200

vdelecroix gravatar image

i have just installed sage to ubuntu 15.10, and have been following along the 'tour of sage' and have been trying to get graphics to be produced from different functions, for example

sage: show(plot(sin(x) + sin(1.6*x), 0, 40))
Launched png viewer for Graphics object consisting of 1 graphics primitive

but not png viewer was launched. am i missing something?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-01-11 23:42:25 +0200

eric_g gravatar image

updated 2016-01-12 19:03:21 +0200

Unfortunately, the Sage 6.10 binary for Ubuntu 15.10 is somehow buggy (more precisely it is built with a version of gcc that is not too old with the respect to library shipped with Ubuntu 15.10). This is a known problem, which will be solved in Sage 7.0. Meanwhile, a fix is indicated in this post: you have to type the following commands in a terminal (i.e. outside any Sage session)

cd SageMath/local/lib64
ln -s /usr/lib/x86_64-linux-gnu/

Then the png viewer will be back at the next Sage session.

edit flag offensive delete link more


yeah that worked, now can you explain what just happened, and why that solution worked? new to ubuntu

alienfetuseater gravatar imagealienfetuseater ( 2016-01-12 00:47:57 +0200 )edit

The explanation is in Volker Braun's answer to the post linked to by @eric_g.

slelievre gravatar imageslelievre ( 2016-01-12 09:13:11 +0200 )edit

answered 2016-01-11 23:37:12 +0200

vdelecroix gravatar image

Could you try the following from Sage

sage:  from sage.misc.viewer import viewer
sage: viewer.png_viewer()

If your answer is different from 'xdg-open' above you should adapt the steps below.

  1. Make sure that xdg-utils is installed on your computer. You can do it via

    $ sudo apt-get install xdg-utils

  2. Try to open a png file with xdg-open, namely

    $ xdg-open my_picture.png

    where my_picture.png should be replaced by a picture you have on your computer

If the steps 1 and 2 above works but picture still do not show up from Sage, there is something fishy.

edit flag offensive delete link more


sage answers with 'xdg-open'

alienfetuseater gravatar imagealienfetuseater ( 2016-01-12 00:40:03 +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: 2016-01-11 19:57:10 +0200

Seen: 1,356 times

Last updated: Jan 12 '16