On Thursday, 4 April 2019 09:48:58 UTC+3, Yagamy Light wrote:
>
>
>
> On Thursday, 4 April 2019 03:21:22 UTC+3, John H Palmieri wrote:
>>
>>
>>
>> On Wednesday, April 3, 2019 at 4:20:43 PM UTC-7, Yagamy Light wrote:
>>>
>>>
>>>
>>> On Thursday, 4 April 2019 01:58:09 UTC+3, John H Palmieri wrote:
>>>>
>>>>
>>>>
>>>> On Wednesday, April 3, 2019 at 3:13:43 PM UTC-7, Yagamy Light wrote:
>>>>>
>>>>>
>>>>>
>>>>> On Wednesday, 3 April 2019 22:42:15 UTC+3, Samuel Lelievre wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> Le mercredi 3 avril 2019 17:43:51 UTC+2, Yagamy Light a écrit :
>>>>>>>
>>>>>>> # Steps to reproduce (in terms of terminal comands:
>>>>>>>
>>>>>>>     $ cat sagemath_test.sage
>>>>>>>     plot(graphs.HeawoodGraph())
>>>>>>>     $ sage
>>>>>>>     
>>>>>>> ┌────────────────────────────────────────────────────────────────────┐
>>>>>>>     │ SageMath version 8.7, Release Date: 2019-03-23                
>>>>>>>      │
>>>>>>>     │ Using Python 2.7.16. Type "help()" for help.                  
>>>>>>>      │
>>>>>>>     
>>>>>>> └────────────────────────────────────────────────────────────────────┘
>>>>>>>     sage: load("sagemath_test.sage")
>>>>>>>
>>>>>>> ## Expected
>>>>>>>
>>>>>>> A PNG viewer gets launched
>>>>>>>
>>>>>>> ## Actual
>>>>>>>
>>>>>>> Nothing happens.
>>>>>>>
>>>>>>> # Additional information
>>>>>>>
>>>>>>> I fond it as part of this problem 
>>>>>>> https://ask.sagemath.org/question/46004/evaluate-py-file/ It seems 
>>>>>>> to stuck in moderation, but basically: I spent some hours trying to 
>>>>>>> figure 
>>>>>>> out how to get sage to draw a graph in a browser (similar to examples 
>>>>>>> from 
>>>>>>> https://wiki.sagemath.org/interact/graph_theory), so far to no 
>>>>>>> avail.
>>>>>>>
>>>>>>
>>>>>> Try changing your file to contain this instead:
>>>>>>
>>>>>> graphs.HeawoodGraph().plot().show()
>>>>>>
>>>>>
>>>>> Thanks for the workaround, I'll try tomorrow!
>>>>>
>>>>> While on it: as I understand this gonna show the plot in default PNG 
>>>>> viewer, right? However if I want to code an interactive app, such as any 
>>>>> of 
>>>>> examples at [1], I need sage to open it in a browser, right? How do I 
>>>>> achieve that?
>>>>>
>>>>> 1:  https://wiki.sagemath.org/interact/graph_theory
>>>>>
>>>>
>>>> Sage's "interacts" are available if you run Sage in its notebook 
>>>> interface: run "sage -n jupyter", and then you can for example paste the 
>>>> following code into a cell in the notebook:
>>>>
>>>> @interact
>>>> def _(graph=['CycleGraph', 'CubeGraph', 'RandomGNP'],
>>>>       n=selector([1..10],nrows=1), p=selector([10,20,..,100],nrows=1)):
>>>>     print graph
>>>>     if graph == 'CycleGraph':
>>>>        print "n = %s (number of vertices)"%n
>>>>        G = graphs.CycleGraph(n)
>>>>     elif graph == 'CubeGraph':
>>>>        if n > 8:
>>>>            print "n reduced to 8"
>>>>            n = 8
>>>>        print "n = %s (dimension)"%n
>>>>        G = graphs.CubeGraph(n)
>>>>     elif graph == 'RandomGNP':
>>>>        print "n = %s (number of vertices)"%n
>>>>        print "p = %s%% (edge probability)"%p
>>>>        G = graphs.RandomGNP(n, p/100.0)
>>>>     print G.automorphism_group()
>>>>     show(plot(G))
>>>>
>>>
>>> Hmm… I don't think I remember seeing in notebook a "Run" button, but 
>>> maybe it's because I named the file I was opening as ".py" instead of 
>>> ".sage". I'll re-try that tomorrow (or, rather around 6 hours later that I 
>>> left to sleep :D).
>>>
>>
>> I don't understand what you mean by a "Run" button. At the terminal:
>>
>> $ sage -n jupyter
>>
>> and then create a new notebook (using the "New" button and selecting 
>> SageMath).
>>
>
> "Run" is the button inside the notebook when selecting "SageMath" that 
> makes it to evaluate :)
>  
>
>>
>>> Either way, the problem I might have with "notebook" is that I edit the 
>>> file externally in Emacs. Does the notebook reload the file automatically?
>>>
>>
>> Don't load the file, just paste the code directly into the notebook cell. 
>> (You can load the file, and no, it won't reload automatically. The command 
>> "%attach FILENAME" is supposed to load it and then reload when the file 
>> changes, but that doesn't seem to be working for me, I don't know why.)
>>
>> Once you get everything working how you want, you can also use 
>> SageMathCell to run it on a webpage: visit https://sagecell.sagemath.org.
>>
>
> Well, first of all, copying stuff between the file and the "notebook" 
> every time I want to change a letter is clearly a lot of hassle.
>
> But worse than that is that I gonna need to use SageMath as a visualizer 
> to debug a graph algorithm, and the script for debugging gotta be shipped 
> with other source code I have. And the script needs to take care of 
> everything, starting with starting the sage notebook, and up to 
> automatically starting evaluation of the code without making the user to 
> press "Run" button.
>

Okay, this is a bit offtopic to the original post, let's better continue in 
thread titled "Getting plots in a browser from a .sage script" that I gonna 
post in some minutes.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to