ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 12 Jul 2014 18:52:36 +0200plt.show() and plt.draw() doesnt workhttps://ask.sagemath.org/question/23387/pltshow-and-pltdraw-doesnt-work/Hi experts!
I have a numpy array M. I generate a graph using NetworkX and then I want to draw this graph:
import networkx as nx
import matplotlib.pyplot as plt
G=nx.Graph(M)
nx.draw(G)
plt.draw()
Doing this, no picture appears. In addition, if I do `plt.show()` no picture appears neither.
If I do
import numpy as np
import matplotlib.pyplot as plt
x = np.range(0, 5, 0.1);
y = np.sin(x)
plt.plot(x, y)
no picture appears neither.
What happend?
Please help!
Best regardsmresimulatorSat, 12 Jul 2014 18:52:36 +0200https://ask.sagemath.org/question/23387/How to if python script runs in notebook?https://ask.sagemath.org/question/8675/how-to-if-python-script-runs-in-notebook/I wrote a small piece of python code which i use as a module in python as well as in a worksheet in sage notebook.
Since this script uses pyplot i'd like to do something like
if in_notebook: pyplot.savefig('fig')
else: pyplot.show()
How can i find out where the script is running in?
At the moment i'm querying sys.executable, but i guess this can be done better.buergiFri, 27 Jan 2012 11:30:53 +0100https://ask.sagemath.org/question/8675/