diff --git a/pkgs/plot-pkgs/plot-lib/plot/private/common/parameters.rkt b/pkgs/plot-pkgs/plot-lib/plot/private/common/parameters.rkt index 05ab8990d6..ea2f558d5d 100644 --- a/pkgs/plot-pkgs/plot-lib/plot/private/common/parameters.rkt +++ b/pkgs/plot-pkgs/plot-lib/plot/private/common/parameters.rkt @@ -3,6 +3,7 @@ ;; Parameters that control the look and behavior of plots. (require racket/contract unstable/parameter-group unstable/latent-contract/defthing + racket/class racket/draw "contract.rkt" "draw.rkt" "axis-transform.rkt" @@ -107,11 +108,17 @@ ;; 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-jpeg-quality (integer-in 0 100) 100) (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 diff --git a/pkgs/plot-pkgs/plot-lib/plot/private/contracted/parameters.rkt b/pkgs/plot-pkgs/plot-lib/plot/private/contracted/parameters.rkt index 00fa31d543..16c695cab8 100644 --- a/pkgs/plot-pkgs/plot-lib/plot/private/contracted/parameters.rkt +++ b/pkgs/plot-pkgs/plot-lib/plot/private/contracted/parameters.rkt @@ -28,7 +28,7 @@ plot3d-samples plot3d-angle plot3d-altitude 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-x-label plot-y-label plot-z-label plot-x-far-label plot-y-far-label plot-z-far-label diff --git a/pkgs/plot-pkgs/plot-lib/plot/private/no-gui/plot2d.rkt b/pkgs/plot-pkgs/plot-lib/plot/private/no-gui/plot2d.rkt index 2ddfda2592..cc755f46c8 100644 --- a/pkgs/plot-pkgs/plot-lib/plot/private/no-gui/plot2d.rkt +++ b/pkgs/plot-pkgs/plot-lib/plot/private/no-gui/plot2d.rkt @@ -112,12 +112,14 @@ [(ps pdf svg) (define dc (case real-kind - [(ps) (new post-script-dc% - [interactive (plot-ps/pdf-interactive?)] [parent #f] [use-paper-bbox #f] - [as-eps #t] [width width] [height height] [output output])] - [(pdf) (new pdf-dc% - [interactive (plot-ps/pdf-interactive?)] [parent #f] [use-paper-bbox #f] - [width width] [height height] [output output])] + [(ps) (parameterize ([current-ps-setup (plot-ps-setup)]) + (new post-script-dc% + [interactive (plot-ps/pdf-interactive?)] [parent #f] [use-paper-bbox #f] + [as-eps #t] [width width] [height height] [output output]))] + [(pdf) (parameterize ([current-ps-setup (plot-ps-setup)]) + (new pdf-dc% + [interactive (plot-ps/pdf-interactive?)] [parent #f] [use-paper-bbox #f] + [width width] [height height] [output output]))] [(svg) (new svg-dc% [width width] [height height] [output output] [exists 'truncate/replace])])) (define-values (x-scale y-scale) (send dc get-device-scale)) diff --git a/pkgs/plot-pkgs/plot-lib/plot/private/no-gui/plot3d.rkt b/pkgs/plot-pkgs/plot-lib/plot/private/no-gui/plot3d.rkt index e29ea97514..6dd1ccdc2e 100644 --- a/pkgs/plot-pkgs/plot-lib/plot/private/no-gui/plot3d.rkt +++ b/pkgs/plot-pkgs/plot-lib/plot/private/no-gui/plot3d.rkt @@ -129,12 +129,14 @@ [(ps pdf svg) (define dc (case real-kind - [(ps) (new post-script-dc% - [interactive (plot-ps/pdf-interactive?)] [parent #f] [use-paper-bbox #f] - [as-eps #t] [width width] [height height] [output output])] - [(pdf) (new pdf-dc% - [interactive (plot-ps/pdf-interactive?)] [parent #f] [use-paper-bbox #f] - [width width] [height height] [output output])] + [(ps) (parameterize ([current-ps-setup (plot-ps-setup)]) + (new post-script-dc% + [interactive (plot-ps/pdf-interactive?)] [parent #f] [use-paper-bbox #f] + [as-eps #t] [width width] [height height] [output output]))] + [(pdf) (parameterize ([current-ps-setup (plot-ps-setup)]) + (new pdf-dc% + [interactive (plot-ps/pdf-interactive?)] [parent #f] [use-paper-bbox #f] + [width width] [height height] [output output]))] [(svg) (new svg-dc% [width width] [height height] [output output] [exists 'truncate/replace])])) (define-values (x-scale y-scale) (send dc get-device-scale))