We are dealing with a graphing calculator after all, so it makes sense that there are lots of graphics commands to talk about. Although the graphical capabilities of the calculator are limited (a monochrome LCD with either 160x100 or 240x128 resolution) these commands allow programmers to squeeze everything out of the screen that they can.
This page is divided into two sections: "Drawing commands" for general tasks like drawing lines, circles, or individual pixels, and "Graphing commands" which deal with the graphs of various functions. If you're not interested in the math aspects of graphics, you might want to skip the second section, especially at first reading.
However, all functions discussed on this page share a common aspect: their difference from normal graphing. When an equation variable is graphed, the result is semi-permanent: using a command like ClrDraw to clear the screen, or changing some setting, can do nothing more than cause the graph to be redrawn. However, all of the commands on this page produce "drawn items" which disappear permanently when the screen is cleared.
Drawing Commands
If you want to draw an image on the screen, you have two choices. First, you can build it up from simple shapes like dots, circles and lines. This may work great for an user interface, but it pretty much limits you to stick figures when you want to draw anything more complicated. So the other option is to have a picture already stored in a variable, and just display it to the screen as you need to. We'll cover both of these in order.
A universally useful drawing command is ClrDraw: this clears everything drawn on the graphscreen.
Point vs. Pixel
TI-Basic allows two ways of specifying a location on the screen: "point" coordinates and "pixel" coordinates. The point coordinates are the ones that you see most often: they are the coordinates determined by the graphing window, with (xmin,ymin) being the bottom left corner and (xmax,ymax) the top right. Because the graphing window has to be initialized if you want to use these in a logical way, this is NOT usually the best type of coordinate to use.
The alternative is pixel coordinates ("pixel" refers to the individual dots that make up the calculator screen). The graphscreen is made up of 77 rows and 159 columns of pixels, and 103 rows and 239 columns on a widescreen calculator (this ignores the rightmost column of pixels, which can't be drawn to). So the pixel coordinates refer to each pixel by the pair (row,column). This is actually the reverse of the point coordinates: the first number determines the vertical location, and the second number the horizontal location. The rows and columns are numbered starting from 0, and the 0th row is the top row. So (0,0) refers to the top left pixel of the graphscreen, and (76,158) or (102,238) refers to the bottom right pixel.
For pretty much every drawing command, you have to specify a location on the graphscreen at which to draw. You can choose either type of coordinate (although your life will be simpler with pixel coordinates) — for every point command, there's a matching pixel command, and vice versa (with an exception we'll get to later).
For example, you can draw a line with the Line command, and the syntax will be:
Line x1,y1,x2,y2
Or you can use the PxlLine command, with the syntax:
PxlLine row1,col1,row2,col2
The following table gives you all the simple drawing commands in their two forms:
Point Coordinates | Pixel Coordinates |
---|---|
Circle | PxlCrcl |
Line | PxlLine |
LineHorz | PxlHorz |
LineVert | PxlVert |
PtChg | PxlChg |
PtOff | PxlOff |
PtOn | PxlOn |
ptTest() | pxlTest() |
PtText | PxlText |
Sprites
Using picture variables, you can store a rectangular image of any size, to be displayed on the screen later. In video game language, such an image is often called a sprite.
The several commands that deal with picture variables are covered in-depth in the Sprites article (CyclePic is described in the Animation article because, you guessed it, it lets you display an animated image). One important thing to note is that they only use pixel coordinates — another reason to use these.
The seven sprite commands are:
Graphing Commands
The usual way of graphing is to store to an equation variable such as y1(x), and then simply go to the graph screen (where you can resize the window and other fun stuff). For the convenience of programmers, any sort of graph manipulation you can choose from a menu is also available as a command. The 68k calculators also provide another way of graphing, probably more suitable to programmers, which draws a graph of a specific expression.
Graphing Expressions
These simulate graphing an equation from any graphing mode. Of special note is the Graph command — unlike the other commands, which can be erased with ClrDraw or any other way of refreshing the screen, the output of Graph can only be erased by ClrGraph or by going to the Y= screen to re-enable the normal Y= functions.
Zoom Commands
The zoom commands resize the graphing window determined by xmin, xmax, ymin, and ymax. For the most part, these four variables are all they change. The exception is ZoomStd, which restores certain other values to their defaults, and ZoomSto and ZoomRcl, which back up and restore all window variables.
Graph Manipulation
These final commands are more or less miscellaneous. Their uniting characteristic is that they deal with the graph of an actual equation variable (the ones you edit in the Y= screen). Of these, FnOff is probably the one to remember: it turns off all equation variables without actually deleting them.