Ask Your Question

Chitrank Dixit's profile - activity

2015-03-26 13:54:09 +0100 received badge  Famous Question (source)
2014-01-30 12:20:42 +0100 received badge  Notable Question (source)
2013-11-02 01:12:11 +0100 received badge  Popular Question (source)
2013-04-08 13:17:43 +0100 marked best answer How can I save an image from sage plot ?

The show() method calls plot(), saves to a temporary file, and then runs an image viewer with the output. If you just want the file, use plot().save('filename.png').

2013-04-08 13:17:42 +0100 marked best answer How can I save an image from sage plot ?

You will need to use the plot method to be able to save, as the show method returns None. Say G is a Graph. Then the following saves a picture of G to filename.png.

sage: p = G.plot()
sage: p.save('filename.png')
2013-04-08 13:17:42 +0100 received badge  Scholar (source)
2013-04-08 13:17:38 +0100 received badge  Supporter (source)
2013-04-08 09:36:12 +0100 asked a question How can I save an image from sage plot ?

I am working on a project that needs the graph image generated by sage to save to disk then that would be retrieved in the application. Here is the code I am writing for generating a Graph

G=Graph({'a': {'c': 25, 'b': 26, 'e': 30, 'd': 35}, 'c': {'a': 25, 'b': 33, 'e':
27, 'd': 7}, 'b': {'a': 26, 'c': 33, 'e': 34, 'd': 7}, 'e': {'a': 30,
'c': 27, 'b': 34, 'd': 9}, 'd': {'a': 35, 'c': 7, 'b': 7, 'e': 9}})

G.weighted(True)

E = kruskal(G, check=True)

print E

tot=[]

kcost=0;totcost=0

for key in E:

        tot.append((key[0],key[1]))
        kcost=kcost+key[2]

rev=tot[::-1]

for key in rev:

        tot.append((key[1],key[0]))

path=[]

tot1=[]    

for key in E:

        tot1.append((key[0],key[1]))
        tot1.append((key[0],key[1]))
        kcost=kcost+key[2]


for p in tot1:

        if p[0] not in path:
            path.append(p[0])
        if p[1] not in path:
            path.append(p[1])

print path 

print tot1    

kcost=totcost/2

print tot,totcost,kcost

N=Graph(E)

N.show()

N1=Graph(tot1)

N1.show()

N.show() and N1.show() will show the Graph describing Now I am facing error running the file and generating image and my image viewer gives me error as in this post of your Google + community I have posted

https://plus.google.com/u/0/113942220...

So I am Planning to save the image at my selected location and fetch the image from that Position. for that I am using in my code and unsure where to supply a or how to save it Please suggest me how should I save the Images from show() method. I am using Python2.7 does it require some additional package of sagemath.

N1=Graph(tot)
a=N1.show()
newimage=Image.new("RGB",(500,500),"white")
newimage.load()    
newimage.save("out.png")
2013-03-31 14:38:40 +0100 commented answer How to locate sage at Python shell

I need to make a working desktop based application using Tkinter using sage. I am able to import Tkinter in sage but when I try to run a Tkinter file from sage I am unable to do so. (using "sage -python /filepath/file.py")

2013-03-31 07:17:26 +0100 received badge  Student (source)
2013-03-30 17:56:15 +0100 asked a question How to locate sage at Python shell

I am using sage on Localhost and on Sage command Shell but I am unable to use it with Python Command Shell. I am working on a Project that needs Tkinter to take User Input and Sage to produce the Output.

Is there any way to use Sage with Tkinter (Sorry I am new to Sage if this might be a weird question)