Sage on Mac OS X Latex Error

15 views
Skip to first unread message

Michael Frey

unread,
Jan 10, 2017, 12:12:20 AM1/10/17
to sage-support
I am trying to generate a plot in sage with matplotlib.  When I execute a safefig I get an error:

RuntimeError: LaTeX was not able to process the following string:
'lp'
Here is the full report generated by LaTeX:

Hopefully there is an easy fix for this.  The code works on Centos.

Mike

Code:
def shape_plot(rf_shape_pl, amp_shape_pl, phase_shape_pl, Pname_sh):
    """
    Plot Pulse Shape
    """
    x_line= srange(0, 1, 1/len(rf_shape_pl))
    sh_r=ceil(max(rf_shape_pl))
    if sh_r < abs(floor(min(rf_shape_pl))): sh_r = abs(floor(min(rf_shape_pl)))
    fig = Figure(figsize=(8,3))
    fig.subplots_adjust(bottom=0.18, top=0.88, left=0.06, right= 0.97, wspace=0.3, hspace=0.35)
    canvas = FigureCanvas(fig)
    
    ax = fig.add_subplot(131)
    ax.axvline(x=0, color='0' )
    ax.axhline(y=0, color='0' )
    ax.set_xlabel('shape', fontsize=('small'))
    ax.plot(x_line, rf_shape_pl, color='r')
    ax.set_ylim(-sh_r,sh_r)

    bx = fig.add_subplot(132)
    bx.axvline(x=0, color='0' )
    bx.axhline(y=0, color='0' )
    bx.set_xlabel('amplitude only', fontsize=('small'))
    bx.plot(x_line, amp_shape_pl, color='b')
    bx.set_title(Pname_sh)

    cx = fig.add_subplot(133)
    cx.axvline(x=0, color='0' )
    cx.axhline(y=0, color='0' )
    cx.set_xlabel('phase only', fontsize=('small'))
    cx.plot(x_line, phase_shape_pl*180/np.pi, color='g')
    cx.set_ylim(-10,190)
    fig.savefig(DATA+'shape_plot.png')

Reply all
Reply to author
Forward
0 new messages