[racket] Plotting in the x and y dimensions

From: Kieron Hardy (kieron.hardy at gmail.com)
Date: Mon Sep 16 07:51:36 EDT 2013

In the plot collection, it currently seems possible to plot only in the
z-dimension, i.e. plot functions where the z value is derived from some

I needed the ability to plot functions where: x is derived from some
f(y,z); and y is derived from some f(x,z). In case it is useful to others,
my solution is on github at https://github.com/khardy/racket-surface3d.git

I copied intact the existing surface3d form to create surface3d/z (i.e.
calculate z from x and y) and then derived two new forms, surface/x and
surface/y, that calculate values for the x and y dimensions respectively.
Some refactoring could be useful, since the three forms differ only in the
various permutations of which dimension's min's and max's and values get
used where, but maybe not worth the effort for just those three.

The new forms are in surface3d-xyz.rkt. The demo (surface3d-xyz-demo.rkt)
below show drawing three surfaces, one each for part of the x, y, and z
axes around the origin.




#lang racket/base

(require plot)
(require "surface3d-xyz.rkt")

      (lambda (y z) 0) ; plot x = 0
      -2 2 ; y-min/y-max
      -2 2 ; z-min/z-max
      #:label "x = 0"
      #:color 3
      (lambda (x y) 0) ; plot y = 0
      -2 2 ; x-min/x-max
      -2 2 ; z-min/z-max
      #:label "y = 0"
      #:color 5
      (lambda (x y) 0) ; plot z = 0
      -2 2 ; x-min/x-max
      -2 2 ; y-min/y-max
      #:label "z = 0"
      #:color 7
  #:x-min -3 #:x-max 3
  #:y-min -3 #:y-max 3
  #:z-min -3 #:z-max 3
  #:altitude 25
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130916/a8ebe3fa/attachment.html>

Posted on the users mailing list.