Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 2012-08-29 17:34:11 -0500

calc314 gravatar image

display matplotlib graphic in Sage cell server

I'm writing a histogram interact in the Sage cell server at aleph.sagemath.org, and I can't get the graphic to display. The graphics display nicely within the interact in Sage 5.0 on my local installation, but won't appear in Sage 5.2 on the cell server. What can I do to display the graphic?

import matplotlib.pyplot as plt
@interact
def doit(title='Title',xlabel=('horizontal axis label','xlabel'),ylabel=('vertical axis label','ylabel'),numbins=slider(1,100,1,8,'number of bins'),data=input_box([358,311,172,190,369,298,308,330,223,187,371,419,296,298,258])):
    plt.figure()
    hp=plt.hist(data,bins=numbins)
    plt.title(title)
    plt.xlabel(xlabel)
    plt.ylabel(ylabel)
    plt.savefig(SAGE_TMP+'test2.png')
click to hide/show revision 2
retagged

display matplotlib graphic in Sage cell server

I'm writing a histogram interact in the Sage cell server at aleph.sagemath.org, and I can't get the graphic to display. The graphics display nicely within the interact in Sage 5.0 on my local installation, but won't appear in Sage 5.2 on the cell server. What can I do to display the graphic?

import matplotlib.pyplot as plt
@interact
def doit(title='Title',xlabel=('horizontal axis label','xlabel'),ylabel=('vertical axis label','ylabel'),numbins=slider(1,100,1,8,'number of bins'),data=input_box([358,311,172,190,369,298,308,330,223,187,371,419,296,298,258])):
    plt.figure()
    hp=plt.hist(data,bins=numbins)
    plt.title(title)
    plt.xlabel(xlabel)
    plt.ylabel(ylabel)
    plt.savefig(SAGE_TMP+'test2.png')