#### 3.5.3 Coordinate systems ¶

Most Yorick graphics styles define only a single coordinate system. In other words, there is a single transformation between the world coordinates of your data, and the normalized device coordinates (NDC) on the sheet of paper or the screen.

The world-to-NDC transformation maps the x-y limits of your data to a rectangle in NDC space, called the viewport. Normally, Yorick will not draw any part of your data lying outside the viewport. However, you can tell Yorick to use raw NDC coordinates without any transformation by means of the plsys command:

    plsys, 0

tells Yorick not to transform data from subsequent plotting primitives. When you are plotting to “system 0”, your data will not be clipped to the viewport. In NDC coordinates, the bottom left corner of the 8.5 by 11 sheet of paper is always (0,0), and 0.0013 NDC unit is exactly one printer’s point, or 1/72.27 inch.

You can switch back to the default “system 1” plotting with:

    plsys, 1

The fma command also switches you back to “system 1” as a side effect. Switching windows with the window command puts you in the coordinate system where you most recently plotted. Note that plsys returns the old system number if you call it as a function; together with the current_window function you can write new functions which do something elsewhere, then return to wherever you were before.

Remember that there is a special relation between the window on your screen and an 8.5 by 11 inch sheet of paper; the bottom left corner of the visible screen window is not usually at (0,0) in NDC. Instead, the NDC point (0.3993,0.6342) in portrait mode – or (0.5167,0.3993) in landscape mode – remains at the center of your screen window no matter how you resize it. (The points make more sense in inches: (4.25,6.75) – centered horizontally and an equal distance down from the top of the page for portrait orientation, and (5.50,4.25) – centered on the page for landscape orientation.) Furthermore, the screen scale is always 75 dpi or 100 dpi, that is, either 798.29 pixels per NDC unit or 1064.38 pixels per NDC unit.

(I apologize to European users for not making explicit provision for A4 paper. If you use Yorick’s eps command for serious, high quality output, the page positioning is not an issue. For rough draft or working plots, I hope the fact that Yorick produces off-center pictures on A4 paper will not hurt you too much. An inch, incidentally, is 2.54 cm.)

You can also create a graphics style with multiple world coordinate systems. For example, you could define a style with four viewports in a single window, in a two by two array. If your style has more than one coordinate system, you use

    plsys, i

to switch among them, where i can be 0, 1, 2, up to the number of coordinate systems in your style. Each coordinate system has its own limits, logxy, and gridxy parameters. However, all systems in a window must share a single palette (many screens don’t have more colors than what you need for one picture anyway). The limits, logxy, and gridxy commands are meaningless in “system 0”, since there is no coordinate transformation there. If invoked as a function, plsys will return the current coordinate system, which allows you to do something in another system, then reset to the original system.

For interactive use, I find multiple coordinate systems too confusing. Instead, I pop up multiple windows when I need to see several pictures simultaneously. For non-interactive use, you should consider making separate Yorick pictures, saving them with the eps command, then importing the separate pieces into a page layout program to combine them.