Skip to content

Comments

Capture plot parameters in plot-frame and plot3d-frame#45

Merged
bennn merged 1 commit intoracket:masterfrom
alex-hhh:fixup-make-snip
Aug 21, 2018
Merged

Capture plot parameters in plot-frame and plot3d-frame#45
bennn merged 1 commit intoracket:masterfrom
alex-hhh:fixup-make-snip

Conversation

@alex-hhh
Copy link
Collaborator

@alex-hhh alex-hhh commented Aug 3, 2018

plot-frame and plot3d-frame delays the creation of the plot snip object until the size of the canvas is known. This means that the snip creation code is executed outside any parameterize scope and the values of any plot parameters (like plot-decorations?) would be ignored unless they are saved using plot-parameters and restored using parameterize/group

The fix is based on a problem reported here: https://groups.google.com/forum/#!topic/racket-users/ta-245wAYco

The issue was introduced when #39 was fixed, since at that time the plot snip was no longer created withing the scope of the parameterize call.

Here is some example code to test this (previously the two plots would have decorations, even though plot-decorations? is `#f):

#lang racket
(require plot)

(plot-new-window? #t)

(parameterize ((plot-decorations? #f))
  (plot3d (surface3d (λ (x y) (* (cos x) (sin y)))
                     -3.0 3.0 -3.0 3.0)))

(parameterize ((plot-decorations? #f))
  (plot (function sin) #:x-min -3 #:x-max 3))

`plot-frame` and `plot3d-frame` delays the creation of the plot snip object
until the size of the canvas is known.  This means that the snip creation code
is executed outside any `parameterize` scope and the values of any plot
parameters (like `plot-decorations?`) would be ignored unless they are saved
using `plot-parameters` and restored using `parameterize/group`
@alex-hhh
Copy link
Collaborator Author

alex-hhh commented Aug 20, 2018

Hi @bennn , can you please review this pull request or ask someone else in the Racket dev team to review it?

This fixes a bug in the plot package were all plot parameters are ignored when either plot-new-window? is #t or plot-frame is used.

Thanks,
Alex.

@bennn bennn self-assigned this Aug 20, 2018
@bennn bennn merged commit 5974088 into racket:master Aug 21, 2018
bennn added a commit that referenced this pull request Aug 21, 2018
these tests are from the pull request:

<#45>
bennn added a commit that referenced this pull request Aug 21, 2018
(so DrDr doesn't hang waiting for the user to quit manually!)
@alex-hhh alex-hhh deleted the fixup-make-snip branch September 20, 2018 00:34
alex-hhh added a commit to alex-hhh/plot that referenced this pull request Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants