Changed PDF/PS backend to use 1.0 x 1.0 scaling
This makes plotting to a file the same (well, with slight differences) regardless of file format. Scaling and other PS options are controlled by a `plot-ps-setup' parameter. Not sure how useful that is, yet, so it's undocumented.
This commit is contained in:
parent
c1550b673b
commit
efc46ded6d
|
@ -3,6 +3,7 @@
|
||||||
;; Parameters that control the look and behavior of plots.
|
;; Parameters that control the look and behavior of plots.
|
||||||
|
|
||||||
(require racket/contract unstable/parameter-group unstable/latent-contract/defthing
|
(require racket/contract unstable/parameter-group unstable/latent-contract/defthing
|
||||||
|
racket/class racket/draw
|
||||||
"contract.rkt"
|
"contract.rkt"
|
||||||
"draw.rkt"
|
"draw.rkt"
|
||||||
"axis-transform.rkt"
|
"axis-transform.rkt"
|
||||||
|
@ -107,11 +108,17 @@
|
||||||
|
|
||||||
;; Output
|
;; Output
|
||||||
|
|
||||||
|
(define default-plot-ps-setup (new ps-setup%))
|
||||||
|
(send default-plot-ps-setup set-margin 0 0)
|
||||||
|
(send default-plot-ps-setup set-scaling 1 1)
|
||||||
|
|
||||||
(defparam plot-new-window? boolean? #f)
|
(defparam plot-new-window? boolean? #f)
|
||||||
(defparam plot-jpeg-quality (integer-in 0 100) 100)
|
(defparam plot-jpeg-quality (integer-in 0 100) 100)
|
||||||
(defparam plot-ps/pdf-interactive? boolean? #f)
|
(defparam plot-ps/pdf-interactive? boolean? #f)
|
||||||
|
(defparam plot-ps-setup (is-a?/c ps-setup%) default-plot-ps-setup)
|
||||||
|
|
||||||
(define-parameter-group plot-output (plot-new-window? plot-jpeg-quality plot-ps/pdf-interactive?))
|
(define-parameter-group plot-output
|
||||||
|
(plot-new-window? plot-jpeg-quality plot-ps/pdf-interactive? plot-ps-setup))
|
||||||
|
|
||||||
;; Labels
|
;; Labels
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
plot3d-samples
|
plot3d-samples
|
||||||
plot3d-angle plot3d-altitude
|
plot3d-angle plot3d-altitude
|
||||||
plot3d-ambient-light plot3d-diffuse-light? plot3d-specular-light?
|
plot3d-ambient-light plot3d-diffuse-light? plot3d-specular-light?
|
||||||
plot-new-window? plot-jpeg-quality plot-ps/pdf-interactive?
|
plot-new-window? plot-jpeg-quality plot-ps/pdf-interactive? plot-ps-setup
|
||||||
plot-title
|
plot-title
|
||||||
plot-x-label plot-y-label plot-z-label
|
plot-x-label plot-y-label plot-z-label
|
||||||
plot-x-far-label plot-y-far-label plot-z-far-label
|
plot-x-far-label plot-y-far-label plot-z-far-label
|
||||||
|
|
|
@ -112,12 +112,14 @@
|
||||||
[(ps pdf svg)
|
[(ps pdf svg)
|
||||||
(define dc
|
(define dc
|
||||||
(case real-kind
|
(case real-kind
|
||||||
[(ps) (new post-script-dc%
|
[(ps) (parameterize ([current-ps-setup (plot-ps-setup)])
|
||||||
[interactive (plot-ps/pdf-interactive?)] [parent #f] [use-paper-bbox #f]
|
(new post-script-dc%
|
||||||
[as-eps #t] [width width] [height height] [output output])]
|
[interactive (plot-ps/pdf-interactive?)] [parent #f] [use-paper-bbox #f]
|
||||||
[(pdf) (new pdf-dc%
|
[as-eps #t] [width width] [height height] [output output]))]
|
||||||
[interactive (plot-ps/pdf-interactive?)] [parent #f] [use-paper-bbox #f]
|
[(pdf) (parameterize ([current-ps-setup (plot-ps-setup)])
|
||||||
[width width] [height height] [output output])]
|
(new pdf-dc%
|
||||||
|
[interactive (plot-ps/pdf-interactive?)] [parent #f] [use-paper-bbox #f]
|
||||||
|
[width width] [height height] [output output]))]
|
||||||
[(svg) (new svg-dc%
|
[(svg) (new svg-dc%
|
||||||
[width width] [height height] [output output] [exists 'truncate/replace])]))
|
[width width] [height height] [output output] [exists 'truncate/replace])]))
|
||||||
(define-values (x-scale y-scale) (send dc get-device-scale))
|
(define-values (x-scale y-scale) (send dc get-device-scale))
|
||||||
|
|
|
@ -129,12 +129,14 @@
|
||||||
[(ps pdf svg)
|
[(ps pdf svg)
|
||||||
(define dc
|
(define dc
|
||||||
(case real-kind
|
(case real-kind
|
||||||
[(ps) (new post-script-dc%
|
[(ps) (parameterize ([current-ps-setup (plot-ps-setup)])
|
||||||
[interactive (plot-ps/pdf-interactive?)] [parent #f] [use-paper-bbox #f]
|
(new post-script-dc%
|
||||||
[as-eps #t] [width width] [height height] [output output])]
|
[interactive (plot-ps/pdf-interactive?)] [parent #f] [use-paper-bbox #f]
|
||||||
[(pdf) (new pdf-dc%
|
[as-eps #t] [width width] [height height] [output output]))]
|
||||||
[interactive (plot-ps/pdf-interactive?)] [parent #f] [use-paper-bbox #f]
|
[(pdf) (parameterize ([current-ps-setup (plot-ps-setup)])
|
||||||
[width width] [height height] [output output])]
|
(new pdf-dc%
|
||||||
|
[interactive (plot-ps/pdf-interactive?)] [parent #f] [use-paper-bbox #f]
|
||||||
|
[width width] [height height] [output output]))]
|
||||||
[(svg) (new svg-dc%
|
[(svg) (new svg-dc%
|
||||||
[width width] [height height] [output output] [exists 'truncate/replace])]))
|
[width width] [height height] [output output] [exists 'truncate/replace])]))
|
||||||
(define-values (x-scale y-scale) (send dc get-device-scale))
|
(define-values (x-scale y-scale) (send dc get-device-scale))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user