Skip to content

Conversation

@lexi-lambda
Copy link
Member

This makes it possible to add horizontal error bars to a horizontal histogram.

@samth samth requested a review from alex-hhh June 30, 2020 11:07
@alex-hhh
Copy link
Collaborator

HI @lexi-lambda , I had a look at the changes and the look good, I would like to ask you to make two changes:

  • pull from master into your branch, as I have configured a CI build, and I would like to see if this works for your branch
  • can you please add a test case to https://github.com/racket/plot/tree/master/plot-test/plot/tests/PRs, currently there are no automated tests, so all I would like is a small example illustrating the new #:invert? option on the error bars

Thanks,
Alex.

@alex-hhh
Copy link
Collaborator

alex-hhh commented Jul 3, 2020

I was a bit confused by the way this works, as I was expecting to simply have to set #:inverted? to #t, but it seems that one also has to swap the coordinates. This, however seems consistent with the way discrete-histogram works...

#lang racket
(require plot)
(plot-width 300)
(plot-height 300)
(list
(plot (list (function sqr 1 7)
              (error-bars (list (vector 2 4 12)
                                (vector 4 16 20)
                                (vector 6 36 10))
                          #:invert? #f)))
;; NOTE: both the invert? parameter and the coordinates need to be inverted.
(plot (list (function sqr 1 7)
              (error-bars (list (vector 4 2 12)
                                (vector 16 4 20)
                                (vector 36 6 10))
                          #:invert? #t))))

pr59

@alex-hhh alex-hhh merged commit 008b6a7 into racket:master Jul 3, 2020
@alex-hhh alex-hhh mentioned this pull request Jul 9, 2020
alex-hhh added a commit to alex-hhh/plot that referenced this pull request Jul 16, 2020
This commit introduces the a new way of writing plot tests where a sample plot
is recorded and compared against the current rendering of the plot.  These
types of tests have the ability to automatically detect changes in the way the
plots are rendered.

This commit only adds tests for changes in racket#5 and racket#59, since these were
recently merged and had no tests, as well as racket#55 since this pull request used
3D plots, and I wanted to validate the method for 3D plots as well.

Instead of comparing bitmap or vector images, plots are rendered using
`plot/dc` or `plot3d/dc` to a special `record-dc%` object and the draw steps
are written to a file. When running the tests, the new set of draw steps are
generated and compared to the saved ones.

The `record-dc%` used for drawing is updated to report consistent values for
text dimensions, regardless of the font -- this allows the data files to be
used across different platforms which would generate slightly different plot
images due to different fonts being available.

In addition to this, a sample PNG image is saved for each plot -- this allows
the user to manually run the tests and having something to compare the result.

The verification steps are automated in `check-draw-steps` and
`check-draw-steps3d` such that, when a verification fails, a new set of draw
steps are written to file, as well as a new sample image.

The GitHub Actions `ci.yml` has been updated to upload these files as an
artifact, so we have the data to analyze failed runs on GitHub Actions. The
test will work fine without this feature, so they can be run on DrDr or the
users computer.
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