show() does not show in the right place
Why the show() funtion does not show in the right position?
It should show between the BEFORE and AFTER prints, but actually if you run the code, it will appear right before the first print (see the code): print ("BEFORE SHOW ", i)
print ("Create a graph")
G = Graph(sparse=True)
G.allow_multiple_edges(True)
G.add_edge(1,2,"blue")
G.add_edge(2,3,"green")
G.add_edge(3,1,"red")
G.add_edge(1,4,"green")
G.add_edge(2,4,"red")
G.add_edge(3,4,"blue")
for i in range(5):
print ("BEFORE SHOW ", i)
show(G)
print ("AFTER SHOW ", i)
print ("BEFORE PLOT ", i)
G.plot()
print ("AFTER PLOT ", i)
What do you mean by "not in the right position"? (Your question is very unclear to me!)
It should show between the BEFORE and AFTER prints, but actually if you run the code, it will appear right before the first print: print ("BEFORE SHOW ", i)
show()
isn't necessarily designed to "show" in a particular spot. It is designed to give a graphical representation of whatever you have (not necessarily a plot), but no guarantees to placement, because it was designed for command-line usage originally. Which GUI are you using here - the Sage cell, sagenb, or Sage Math Cloud? It would likely depend on this.I'm using the cloud sagemath worksheet. sagews
I think the original post is questioning the order in which the outputs are displayed in the output of the SMC cell. If my input is something like:
print 1
print 2
I would expect the 1 to be displayed before the 2; in this case, you expect ("BEFORE SHOW ",0) to be the first line of output, followed by the image of the graph, yes? But that's not what it is doing. The topmost output is the graph, then ("BEFORE SHOW ",0), etc.
Is that the question?