Ask Your Question

Revision history [back]

Your construction does not really makes sense : (f+pt1).show(xmin= xmin, xmax= xmax, ymin=-20, ymax=20) does not return anything, since the show method does just plot something, but does not return any object, hence the construction of z corresponds to the empty graph, and you can check:

sage: z == Graph(None)
True

So, what do you want to achieve ?

Your construction does not really makes sense : (f+pt1).show(xmin= xmin, xmax= xmax, ymin=-20, ymax=20) does not return anything, since the show method does just plot something, but does not return any object, hence the construction of z corresponds to the empty graph, and you can check:

sage: z == Graph(None)
True

So, what do you want to achieve ?

EDIT

Only the following 4 lines are useful:

xmin = -10 
xmax = 10
f = plot((x^2-2)/(x+2), (x,xmin, xmax), ymin = -20, ymax = 20)
pt1 = point((-2,2), rgbcolor='blue', pointsize=40)

Everything else is about discrete graphs (those with vertices and edges), not with functionnal graphs, nor graphics.

It turns out that matplotlib, which Sage uses to render such plots is able to export to latex (using pgf package), and Sage has a an interface to it. You can do:

latex(f+pt1)

and copy-paste the long text you get into your latex file. To let the code work, you have to add the pgf package in your latex file:

\usepackage{pgf}