rfeynman
rfeynman

Reputation: 121

from sympy import Plot fail

I am using three different ways to import Plot function. All fail. 1:

from sympy import *
if __name__ == '__main__':
    pp1,pp2,el1,el2=insline(0,0,4,0,1.5,1,1.5,1)
    print pp1.evalf(),pp2.evalf()
    p=Plot()
    p[0]=el1
    p[1]=el2
    p[2]=Segment(pp1,pp2)
    p.show()

Shows:

Traceback (most recent call last):
File "C:\Users\Erdong\workspace\Gungeo\src\gungeo.py", line 39, in <module>
p=Plot()

NameError: name 'Plot' is not defined

2:

from sympy import Point, Ellipse, intersection, Segment,plot
import math
def
...

if __name__ == '__main__':
    pp1,pp2,el1,el2=insline(0,0,4,0,1.5,1,1.5,1)
    print pp1.evalf(),pp2.evalf()
    p=plot.Plot()
    p[0]=el1
    p[1]=el2
    p[2]=Segment(pp1,pp2)
    p.show()

Shows:

Traceback (most recent call last):
File "C:\Users\Erdong\workspace\Gungeo\src\gungeo.py", line 39, in <module>
p=plot.Plot()
AttributeError: 'function' object has no attribute 'Plot'

3.

from sympy import Plot

Shows:

Traceback (most recent call last):
File "E:\Project\Build up\programming\learn\learn.py", line 7, in <module>
from sympy import Plot
ImportError: cannot import name Plot

Please help how to import Plot from sympy-0.7.6.

I also tried: from sympy.plotting.pygletplot import PygletPlot as Plot But got error also: { Traceback (most recent call last): File "C:\Users\Erdong\workspace\Gungeo\src\gungeo.py", line 92, in p=Plot(el1) File "C:\Python27\lib\site-packages\sympy\plotting\pygletplot__init__.py", line 139, in PygletPlot import plot File "C:\Python27\lib\site-packages\sympy\plotting\pygletplot\plot.py", line 16, in from plot_axes import PlotAxes File "C:\Python27\lib\site-packages\sympy\plotting\pygletplot\plot_axes.py", line 7, in from util import strided_range, billboard_matrix File "C:\Python27\lib\site-packages\sympy\plotting\pygletplot\util.py", line 8, in def get_model_matrix(array_type=c_float, glGetMethod=glGetFloatv): NameError: name 'c_float' is not defined }

Upvotes: 3

Views: 1569

Answers (2)

asmeurer
asmeurer

Reputation: 91580

Maybe you want the old Plot that uses pyglet:

from sympy.plotting.pygletplot import PygletPlot as Plot

Upvotes: 0

Yuvika
Yuvika

Reputation: 6132

Have a look at http://docs.sympy.org/latest/modules/plotting.html. It should be

from sympy import symbols
from sympy.plotting import plot
x = symbols('x')
p = plot(x)

Upvotes: 1

Related Questions