[racket-dev] [plt] Push #28468: master branch updated

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri Apr 4 08:42:19 EDT 2014

I'm not completely clear on the precise impact of old papers: will the plot
itself stay the same size, but the relative size of the font (to the other
plot elements) inside the plot change only? Or something else?

Robby


On Fri, Apr 4, 2014 at 12:08 AM, Neil Toronto <neil.toronto at gmail.com>wrote:

> I did it because I was tired of putting (plot-font-size 15) at the top of
> every program that produced a plot for a paper. Also, I think it was bad
> for the "preview" in DrRacket to look different from the PDFs. (Some of my
> plots in DrRacket had legends that badly overlapped the data in order to
> look right in PDF format.) It will cause existing PDF plots to have larger
> text, which could look wrong in plots that use the font size workaround.
> But I think it's the right move in the long run.
>
> Here's one thing I could do: document `plot-ps-setup' and export an
> `old-plot-ps-setup' that's the default instance of `ps-setup%', so programs
> that produce plots for papers could start this way:
>
>   #lang racket
>   (require plot)
>   (plot-ps-setup old-plot-ps-setup)
>
> Maybe that parameter is useful after all.
>
> Neil ⊥
>
>
> On 04/03/2014 10:37 AM, Robby Findler wrote:
>
>> Is efc46de backwards compatible? (I worry about breaking people's
>> papers, specifically.)
>>
>> Robby
>>
>>
>> On Thu, Apr 3, 2014 at 12:20 AM, <ntoronto at racket-lang.org
>> <mailto:ntoronto at racket-lang.org>> wrote:
>>
>>     ntoronto has updated `master' from 87cfce97f9 to efc46ded6d.
>>     http://git.racket-lang.org/plt/87cfce97f9..efc46ded6d
>>
>>     =====[ 2 Commits ]=============================
>> =========================
>>     Directory summary:
>>         8.2% pkgs/plot-pkgs/plot-lib/plot/private/common/
>>        35.5% pkgs/plot-pkgs/plot-lib/plot/private/no-gui/
>>        12.4% pkgs/plot-pkgs/plot-lib/plot/private/plot3d/
>>        41.2% pkgs/plot-pkgs/plot-test/plot/tests/
>>
>>     ~~~~~~~~~~
>>
>>     c1550b6 Neil Toronto <neil.toronto at gmail.com
>>     <mailto:neil.toronto at gmail.com>> 2014-04-02 22:06
>>
>>     :
>>     | Remove unnecessary use of `remove-duplicates'
>>     :
>>        M .../plot-lib/plot/private/plot3d/bsp.rkt          | 11 +--
>>        M .../plot-test/plot/tests/plot3d-bsp-tests.rkt     | 91
>>     ++++++++------------
>>
>>     ~~~~~~~~~~
>>
>>     efc46de Neil Toronto <neil.toronto at gmail.com
>>     <mailto:neil.toronto at gmail.com>> 2014-04-02 23:16
>>
>>     :
>>     | 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.
>>     :
>>        M pkgs/plot-pkgs/plot-lib/plot/private/no-gui/plot2d.rkt  | 14
>>     ++++++++------
>>        M pkgs/plot-pkgs/plot-lib/plot/private/no-gui/plot3d.rkt  | 14
>>     ++++++++------
>>        M .../plot-lib/plot/private/common/parameters.rkt         |  9
>>     ++++++++-
>>        M .../plot-lib/plot/private/contracted/parameters.rkt     |  2 +-
>>
>>     =====[ Overall Diff ]=============================
>> ======================
>>
>>     pkgs/plot-pkgs/plot-lib/plot/private/common/parameters.rkt
>>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>     --- OLD/pkgs/plot-pkgs/plot-lib/plot/private/common/parameters.rkt
>>     +++ NEW/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
>>
>>
>>     pkgs/plot-pkgs/plot-lib/plot/private/contracted/parameters.rkt
>>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>     --- OLD/pkgs/plot-pkgs/plot-lib/plot/private/contracted/
>> parameters.rkt
>>     +++ NEW/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
>>
>>     pkgs/plot-pkgs/plot-lib/plot/private/no-gui/plot2d.rkt
>>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>     --- OLD/pkgs/plot-pkgs/plot-lib/plot/private/no-gui/plot2d.rkt
>>     +++ NEW/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))
>>
>>     pkgs/plot-pkgs/plot-lib/plot/private/no-gui/plot3d.rkt
>>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>     --- OLD/pkgs/plot-pkgs/plot-lib/plot/private/no-gui/plot3d.rkt
>>     +++ NEW/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))
>>
>>     pkgs/plot-pkgs/plot-lib/plot/private/plot3d/bsp.rkt
>>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>     --- OLD/pkgs/plot-pkgs/plot-lib/plot/private/plot3d/bsp.rkt
>>     +++ NEW/pkgs/plot-pkgs/plot-lib/plot/private/plot3d/bsp.rkt
>>     @@ -499,8 +499,7 @@
>>         (cond
>>           [(empty? ps)  #f]
>>           [else
>>     -     (define vs (remove-duplicates (bsp-polys->vertices ps)))
>>     -     (define axes (vertices->axes vs))
>>     +     (define axes (vertices->axes (bsp-polys->vertices ps)))
>>            (define center (list->flvector (map axis-mid axes)))
>>
>>            ;; Planes defined by neighboring polygon vertices
>>     @@ -530,8 +529,7 @@
>>         (cond
>>           [(empty? ls)  #f]
>>           [else
>>     -     (define vs (remove-duplicates (bsp-lines->vertices ls)))
>>     -     (define axes (vertices->axes vs))
>>     +     (define axes (vertices->axes (bsp-lines->vertices ls)))
>>            (define center (list->flvector (map axis-mid axes)))
>>
>>            ;; Planes defined by line segments and basis vectors (i.e.
>>     one basis in normal is zero)
>>     @@ -560,9 +558,8 @@
>>         (cond
>>           [(and (empty? ls) (empty? ps))  #f]
>>           [else
>>     -     (define vs (remove-duplicates (append (append* (map
>>     lines-vertices ls))
>>     -                                           (append* (map
>>     points-vertices ps)))))
>>     -     (define axes (vertices->axes vs))
>>     +     (define axes (vertices->axes (append (append* (map
>>     lines-vertices ls))
>>     +                                          (append* (map
>>     points-vertices ps)))))
>>            (define center (list->flvector (map axis-mid axes)))
>>
>>            (: try-nondisjoint-split (-> (U #f BSP-Tree)))
>>
>>     pkgs/plot-pkgs/plot-test/plot/tests/plot3d-bsp-tests.rkt
>>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>     --- OLD/pkgs/plot-pkgs/plot-test/plot/tests/plot3d-bsp-tests.rkt
>>     +++ NEW/pkgs/plot-pkgs/plot-test/plot/tests/plot3d-bsp-tests.rkt
>>     @@ -1,23 +1,5 @@
>>       #lang racket
>>
>>     -#|
>>     -TODO
>>     -
>>     -BSP
>>     - - deal better with polygon + many non-polygon shapes
>>     - - avoid more recomputation in build-bsp3d (i.e. precompute
>>     bounding and central planes)
>>     - - make middle shapes in bsp-node a BSP-Tree
>>     - - speed up disjoint splitting
>>     -
>>     -insert line segments into BSP as polygonal clipping regions?
>>     -
>>     -slow parts
>>     - - 22.3: build-bsp-tree
>>     - - 15.6: contour renderer proc
>>     - - 12.7: clip-polygon
>>     - -  6.0: bin-shapes
>>     -|#
>>     -
>>       (require plot
>>                (except-in plot/utils sum flsum sample)
>>                math
>>     @@ -95,41 +77,42 @@ slow parts
>>                        (points3d xyzs #:sym 'dot)))))
>>
>>       (time
>>     - (plot3d
>>     -  (list (contour-intervals3d
>>     -         (λ (x y)
>>     -           (* x (+ 0.1 y)))
>>     -         -1 1 -1 1
>>     -         #:samples 41
>>     -         #:alphas '(0.85)
>>     -         ;#:alpha 0.75
>>     -         ;#:line-width 2
>>     -         ;#:line-widths '(2)
>>     -         ;#:line-styles '(transparent)
>>     -         #:contour-widths '(2)
>>     -         ;#:color 1
>>     -         ;#:label ""
>>     -         )
>>     -
>>     -        (surface3d
>>     -         (λ (x y)
>>     -           (* (- (* (flnormal-pdf 0.0 0.2 (fl x) #f)
>>     -                    (flnormal-pdf 0.0 0.2 (fl y) #f))
>>     -                 0.7)
>>     -              0.4))
>>     -         -1 1 -1 1
>>     -         #:samples 40
>>     -         ;#:alphas '(0.75)
>>     -         #:alpha 0.95
>>     -         #:color "plum"
>>     -         #:line-color 6
>>     -         ;#:line-style 'transparent
>>     -         ;#:line-width 2
>>     -         ))
>>     -  #:x-min -1 #:x-max 1
>>     -  #:y-min -1 #:y-max 1
>>     -  ;#:out-file "test.pdf"
>>     -  ))
>>     + (for/last ([_  (in-range 1)])
>>     +   (plot3d
>>     +    (list (contour-intervals3d
>>     +           (λ (x y)
>>     +             (* x (+ 0.1 y)))
>>     +           -1 1 -1 1
>>     +           #:samples 41
>>     +           #:alphas '(0.85)
>>     +           ;#:alpha 0.75
>>     +           ;#:line-width 2
>>     +           ;#:line-widths '(2)
>>     +           ;#:line-styles '(transparent)
>>     +           #:contour-widths '(2)
>>     +           ;#:color 1
>>     +           ;#:label ""
>>     +           )
>>     +
>>     +          (surface3d
>>     +           (λ (x y)
>>     +             (* (- (* (flnormal-pdf 0.0 0.2 (fl x) #f)
>>     +                      (flnormal-pdf 0.0 0.2 (fl y) #f))
>>     +                   0.7)
>>     +                0.4))
>>     +           -1 1 -1 1
>>     +           #:samples 40
>>     +           ;#:alphas '(0.75)
>>     +           #:alpha 0.95
>>     +           #:color "plum"
>>     +           #:line-color 6
>>     +           ;#:line-style 'transparent
>>     +           ;#:line-width 2
>>     +           ))
>>     +    #:x-min -1 #:x-max 1
>>     +    #:y-min -1 #:y-max 1
>>     +    ;#:out-file "test.pdf"
>>     +    )))
>>
>>       (plot3d (list (surface3d * -1 1 -1 1 #:samples 6 #:alpha 0.75
>>     #:color 1)
>>                     (surface3d (λ (x y) (+ 0.1 (* x y))) -1 1 -1 1
>>     #:samples 6 #:alpha 0.75 #:color 2)
>>     @@ -140,7 +123,7 @@ slow parts
>>       (plot3d (list
>>                (isosurface3d (λ (x y z) (+ (- 1 x) (- 1 y) (- z 1.5))) 0
>>                              #:alpha 0.85 #:color 2 #:line-color 2
>>     -                       #:samples 2)
>>     +                       #:samples 4)
>>                (discrete-histogram3d (list (vector 'a 'a 1)
>>                                            (vector 'a 'b 2)
>>                                            (vector 'b 'b 3))
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20140404/2bc153b9/attachment-0001.html>

Posted on the dev mailing list.