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

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri Apr 4 16:46:14 EDT 2014

I think you're right that the old behavior isn't very useful. I think it is
probably sufficient to have _a_ way to get it (and some note in the docs
and the history file giving people something to paste in somewhere if they
really want the old behavior).

Robby


On Fri, Apr 4, 2014 at 3:25 PM, Neil Toronto <neil.toronto at gmail.com> wrote:

> No need to apologize! I'd feel lost if you didn't ask questions that
> forced me to explain things better. :)
>
> Do you think it's worthwhile to make it easy for people to get the old
> behavior?
>
> Neil ⊥
>
>
> On 04/04/2014 11:28 AM, Robby Findler wrote:
>
>> Oh, I finally understand.
>>
>> Yes, I agree that this is a good change.
>>
>> Sorry for the confusion.
>>
>> Robby
>>
>>
>>
>> On Fri, Apr 4, 2014 at 10:04 AM, Neil Toronto <neil.toronto at gmail.com
>> <mailto:neil.toronto at gmail.com>> wrote:
>>
>>     Yes, the relative size of the font will grow, as well as minor
>>     things, such as that the lines will thicken a bit. IOW, without the
>>     fix, if you output the same plot to a PDF, SVG, and PNG, the PDF
>>     will have a smaller font and thinner lines than the SVG and PNG.
>>
>>     It can be hard to tell without converting them to the same format
>>     for comparison, which is why I didn't spot this for so long. I just
>>     thought papers looked better when plots had slightly larger fonts.
>>
>>     I verified that the fix works by using the Gimp to convert a PDF and
>>     an SVG to two 500x500 images, and pasted one over the other.
>>
>>     Neil ⊥
>>
>>
>>     On 04/04/2014 06:42 AM, Robby Findler wrote:
>>
>>         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 <mailto:neil.toronto at gmail.com>
>>         <mailto:neil.toronto at gmail.com
>>
>>         <mailto: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>
>>                  <mailto:ntoronto at racket-lang.__org
>>         <mailto:ntoronto at racket-lang.org>>
>>                  <mailto:ntoronto at racket-lang.
>>         <mailto:ntoronto at racket-lang.>____org
>>
>>
>>                  <mailto: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
>>         <http://git.racket-lang.org/__plt/87cfce97f9..efc46ded6d>
>>
>>
>>
>>         <http://git.racket-lang.org/__plt/87cfce97f9..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>
>>                  <mailto:neil.toronto at gmail.com
>>         <mailto:neil.toronto at gmail.com>__>
>>                       <mailto:neil.toronto at gmail.com
>>         <mailto:neil.toronto at gmail.com>
>>                  <mailto: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>
>>                  <mailto:neil.toronto at gmail.com
>>         <mailto:neil.toronto at gmail.com>__>
>>                       <mailto:neil.toronto at gmail.com
>>         <mailto:neil.toronto at gmail.com>
>>                  <mailto: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/9559eacb/attachment-0001.html>

Posted on the dev mailing list.