1 | initial version |
plot(f,(x,-3,3))
defines an object. From a .sage
script, this is just the object.
When you call an object from the command line, it wants to be represented, by calling the hidden .__repr__()
method. For a plot object, the .__repr__()
method just calls the .show()
method.
Hence, if you want your .sage
script to show the plot object you defined, you should tell it explicitely, by writing:
plot(f,(x,-3,3)).show()
instead of
plot(f,(x,-3,3))
As a comparison, it is the same difference between
2
and
print(2)
Both will return 2
in the command line, but only the second will write something when called from a .sage
script.
2 | No.2 Revision |
plot(f,(x,-3,3))
defines an a graphical object. From a .sage
script, this is just the object.
When you call an object from the command line, it wants to be represented, by calling the hidden .__repr__()
method. For a plot object, the .__repr__()
method just calls the .show()
method.
Hence, if you want your .sage
script to show the plot graphical object you defined, defined with the command plot
, you should tell it explicitely, by writing:
plot(f,(x,-3,3)).show()
instead ofof just
plot(f,(x,-3,3))
As a comparison, it is the same difference between
2
and
print(2)
Both will return output 2
in the command line, but only the second will write something when called from a .sage
script.