# Small Basic - Cartesian coordinates

• ### Question

• Hello everyone
I am used to working with graphics, using the axis X and Y, within a given timescale.
For a function y = f (x) for each value of x will be a value of y (if the function has a unique solution.)
The graphics in Small Basic use of coordinate axes in the window, in pixels.
That makes it difficult me to resolve a function, when I plot it.
Is there an interface to convert the graphics window to a system with a pair of axes or Cartesian coordinates?.
Regards,

carlosfmur - Buenos Aires
Wednesday, January 11, 2012 12:32 AM

• To write plotting from scratch in SB you will have to convert between screen (pixel) and your data scale.

If your interest is writing a plotting program, then this is what you will have to do.  Typically, the conversion between pixels and data uses an offset and scale.

If xD is a data point and xP is its pixel equivalent:

xP = OffsetX + ScaleX * xD, where OffsetX and ScaleX are chosen appropriately.

Also to convert the other way: xD = (xP - OffsetX) / ScaleX

The same in the Y direction.

If you just want to plot some data, use an extension (see sticky thread on extensions and the LitDev extension has a graphing object) or export to something like Excel.

• Marked as answer by Saturday, January 14, 2012 12:08 AM
Wednesday, January 11, 2012 10:56 AM