Plot coordinate pairs: Difference between revisions

Line 103:
 
PR READ "postlude_exception.a70" PR</lang>'''Output:'''
=={{header|ALGOL 68}}==
{{works with|ALGOL 68|Revision 1 - extensions to standard used - PRAGMA READ and Currying}}
{{works with|ALGOL 68G|Any - tested with release [http://sourceforge.net/projects/algol68/files/algol68g/algol68g-2.4.1 algol68g-2.4.1].}}
{{wont work with|ELLA ALGOL 68|Any (with appropriate job cards) - tested with release [http://sourceforge.net/projects/algol68/files/algol68toc/algol68toc-1.8.8d/algol68toc-1.8-8d.fc9.i386.rpm/download 1.8-8d] - due to extensive use of '''format'''[ted] ''transput''.}}
[[Image:Plot_coordinate_pairs-Algol68.gif|thumb|right|100px|Example Algol68 plot]]
'''File: Plot_coordinate_pairs.a68'''<lang algol68>#!/usr/bin/algol68g-full --script #
# -*- coding: utf-8 -*- #
 
PR READ "prelude_errata.a68" PR;
PR READ "prelude_exception.a68" PR;
PR READ "prelude_math_lib.a68" PR;
 
CO REQUIRED BY "prelude_graph_2d.a68" CO
MODE GREAL= REAL; # single precision #
FORMAT greal repr = $g(-3,0)$;
PR READ "prelude_graph2d.a68" PR;
 
[]REAL x = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
[]REAL y = (2.7, 2.8, 31.4, 38.1, 58.0, 76.2, 100.5, 130.0, 149.3, 180.0);
 
test:(
REF GRAPHDD test graph = INIT LOC GRAPHDD;
 
title OF test graph := "Plot coordinate pairs";
type OF window OF test graph := "gif"; # or gif, ps, X, pnm etc #
sub title OF test graph := "Rosettacode.org";
 
interval OF (axis OF test graph)[x axis] := (0,8);
label OF (axis OF test graph)[x axis] := "X axis";
 
interval OF (axis OF test graph)[y axis] := (0, 200);
label OF (axis OF test graph)[y axis] := "Y axis";
 
PROC curve = (YIELDPOINT yield)VOID:
FOR i TO UPB x DO yield((x[i],y[i])) OD;
 
(begin curve OF (ATTR test graph))(~);
(add curve OF (ATTR test graph))(curve, (red,solid));
(end curve OF (ATTR test graph))(~)
);
 
PR READ "postlude_exception.a70" PR</lang>
=={{header|C}}==