GithubHelp home page GithubHelp logo

plot's Introduction

This is the source code for the Racket "plot" package which used to make 2D and 3D plots. This package is included in the Racket installation, so, if you installed Racket, you can use it straight away. Open DrRacket and type in the follwing in the command window:

(require plot)
(plot (function sin -5 5))

To Get Help

Contributing

You can contribute to this package by creating a pull request, but we recommend joining the Racket Discourse group to discuss the features you plan to add or bugs you intend to fix. Other Racket developers may be able to assist you with advice and providing links to the relevant pieces of code.

By making a contribution, you are agreeing that your contribution is licensed under the Apache 2.0 license and the MIT license.

License

Racket, including these packages, is free software, see LICENSE for more details.

plot's People

Contributors

alex-hhh avatar bdeket avatar bennn avatar camoy avatar capfredf avatar dkempe avatar elibarzilay avatar evdubs avatar gus-massa avatar jackfirth avatar leifandersen avatar lexi-lambda avatar liberalartist avatar mflatt avatar noahstorym avatar ntoronto avatar ralsei avatar rfindler avatar rmculpepper avatar samth avatar snapcracklepopgone avatar stamourv avatar takikawa avatar tonyg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plot's Issues

vector-field3d errors when any coordinate is zero

#lang racket
(require plot math/flonum)
;; works fine
(plot3d (vector-field3d (lambda (x y z) (list 1 1 (flnext 0.0))) 0 10 0 10 0 10))
;; errors with division by zero, should produce vectors in the X/Y plane
(plot3d (vector-field3d (lambda (x y z) (list 1 1 0)) 0 10 0 10 0 10))

This error seems to happen when any coordinate is zero.

Segfault in plot tests

I tried to run the plot/tests/typed/parameter-regression-tests.rkt in DrRacket and get a segfault. It appears that just opening this file (also plot-pict.rkt in the same directory) and waiting for background compilation to finish will trigger a segfault.

@stamourv was also able to reproduce this on his machine.

plot-pict does not return a typed/pict type

On Racket v6.4.0.15, this code fails to compile. Casting p to a pict type makes the program compile and run, but the cast shouldn't be necessary.

#lang typed/racket/base

(require plot/typed/no-gui
         typed/pict)

(define p (plot-pict '() #:x-min 0 #:x-max 0 #:y-min 0 #:y-max 0))
(hc-append 0
           p
           (blank 0 0))

The error message

Type Checker: type mismatch
  expected: pict
  given: Pict
  in: p

Multiple Y Axes sharing the same X Axis?

Hello,

I would like to know if there is a way to have two datasets share an x-axis while using independent y-axes. My use case is to plot stock prices using a price axis and volumes or forward earnings on the same plot
so that they can all be viewed together. Currently, I have the following built where volume rectangles are just drawn on a line near the prices, but the values are obscured this way. I have also tried to look at just having two independent plots, but the x-axis in one does not perfectly align with the other.

Is there a way to do this?

Add parameters to control printing tick points, axis lines.

Hi there,

In the vein #43, I'd love to have parameters to control the printing of tick points and axis lines (while keeping tick labels, unlike [plot-x-axis? #f] or [plot-decorations #f].

I've identified the parts of the drawing code which would need to change --- get-all-tick-params and draw-axes in plot-area, but I don't seem to be able define the parameters in such a way that my main program can see them.

Can anyone help me fill in the gaps?

Large overhead for drawing plots with lots of data points

A private email from a person who noticed poor performance of the plot package when plotting millions of data points, prompted me to run some tests to see what the overhead of the actual plot package is on top of racket/draw (which is used for all the drawing). The result is that it is a lot.

There are two programs below (the second one has two variants):

  • one is drawing a plot using lines
  • the second one ,do-manual-plot will draw the plot using the draw-lines dc<%> method, and do all plotting calculations itself
  • the third one, do-manual-plot/individual-lines will draw the plot using one draw-line call for each line segment, also doing all plotting calculations itself.

Here is the performance of the programs

data points plot draw-lines individual draw-line
100 31ms 15 ms 15ms
1'000 78ms 15ms 15ms
10'000 920ms 93ms 156ms
100'000 81'515ms 3'046ms 1'484ms
1'000'000 too long 45'734ms 16'634ms

For large number of points, the time of the plot version becomes too large very quickly, much more than the time increase for draw-lines and draw-line versions. Note that plot ultimately uses the same draw package, so the plot package overhead is probably the plot time minus the draw-lines time.

I also found that, for large number of points, a single draw-lines call is much slower than multiple draw-line calls, one for each line -- this is somewhat counterintuitive, but I could not find an explanation for this...

#lang typed/racket
(require plot)

(: points (Listof (List Real Real)))
(define points (build-list 100000 (lambda ([x : Index]) (list x (random)))))

(time
 (parameterize ([plot-decorations? #f])
   (plot-bitmap (lines points #:color 6))))
#lang racket
(require racket/draw
         plot ;; just for plot-width, plot-height
         )

(define (transform-points p)
  (define-values (min-x min-y max-x max-y)
    (for/fold ([min-x (first (first points))]
               [min-y (second (first points))]
               [max-x (first (first points))]
               [max-y (second (first points))])
              ([point (in-list (rest points))])
      (define x (first point))
      (define y (second point))
      (values (min min-x x) (min min-y y) (max max-x x) (max max-y y))))
  (define dx (- max-x min-x))
  (define dy (- max-y min-y))
  (define w (plot-width))
  (define h (plot-height))
  (define (transform point)
    (define x (first point))
    (define y (second point))
    (cons (* w (/ (- x min-x) dx))
          (* h (- dy (/ (- y min-y) dy)))))
  (map transform points))

(define (do-manual-plot points)
  (define bm (make-object bitmap% (plot-width) (plot-height)))
  (define dc (new bitmap-dc% [bitmap bm]))
  (send dc set-pen (send the-pen-list find-or-create-pen "purple" 1 'solid))
  (define plot-points (transform-points points))
  (send dc draw-lines plot-points)
  bm)

(define (do-manual-plot/individual-lines points)
  (define bm (make-object bitmap% (plot-width) (plot-height)))
  (define dc (new bitmap-dc% [bitmap bm]))
  (send dc set-pen (send the-pen-list find-or-create-pen "purple" 1 'solid))
  (define plot-points (transform-points points))
  (for ([p1 (in-list plot-points)]
        [p2 (in-list (rest plot-points))])
    (send dc draw-line (car p1) (cdr p1) (car p2) (cdr p2)))
  bm)

(define points (build-list 100000 (lambda (x) (list x (random)))))
(printf "individual draw-line calls~%")
(time (do-manual-plot/individual-lines points))
(printf "single draw-lines call~%")
(time (do-manual-plot points))

Add type for categorical values

discrete-histogram etc. take a variable called cat-vals as their first argument. Right now this can be a sequence of vectors or a sequence of lists, but as Sean Kemplay points out this type isn't really compatible with hashtables. And it would be nice to be able to call discrete-histogram on a hashtable.

I'm thinking the easiest fix is to give plot a type Cat-Vals A that would include the current sequences and also hashtables. Then discrete-histogram3d's input would be a Cat-Vals (Cat-Vals (U Real ivl #f)) and "categorical values" would have their own spot in the docs.

(I'm planning to set up a PR later this afternoon)

far tick labels drawn when parameter is #false

The docs for plot-x-far-tick-labels? etc. say:

When any of these is #f, the corresponding labels for the ticks on the axis are not drawn.

But the corresponding labels are drawn if the plot-x-ticks parameter (etc.) is overridden.

Example:

#lang racket/base
(require plot)
(parameterize* ([plot-x-far-ticks (plot-x-ticks)]
                [plot-y-far-ticks (plot-y-ticks)]
                [plot-x-ticks no-ticks]
                [plot-y-ticks no-ticks]
                [plot-x-far-tick-labels? #false]
                [plot-y-far-tick-labels? #false])
  (plot-pict
    (function values)
    #:x-min 0 #:x-max 2
    #:y-min 0 #:y-max 2))

Output:

plot-far-tick-labels

I think the docs are correct and the code should change somehow, maybe to make plot-x-tick-labels? a 3-valued parameter.

saving a list of plots in a single file in (m x n) layout

Hi, I am a Racket beginner and mostly used Matplotlib for all my scientific plots for publication. Most of the time I need to generate a figure which has a grid-like layout, for example, a (m x n) grid of plots. In Racket I approach this by using

(parameterize ([..]
[..])
  (list 
   (plot (list (lines  x1 y1 )
                   (lines x2 y2))
             #:out-file "plot.pdf")
   (plot (list (lines  x3 y3)
                   (lines x4 y4))
             #:out-file "plot.pdf")))

However, this only saves the second plot. I am looking for a way to save this list of 2 plots in the output file as per my desired grid choice, for example, save to 2x1 or 1x2. Is there an already existing functionality to do this?

Inverting axis transforms

For completeness it seems like the following functions for reversing axis transforms should exist:

;;; Turn an axis transform inside out
(: axis-transform-invert (Axis-Transform -> Axis-Transform))

;;; apply an axis transform in reverse
(: apply-axis-transform/reverse (Axis-Transform Real Real -> Invertible-Function))

Parameter `plot-background-alpha` has no effect (since 8.1)

It seems that plot-background-alpha no longer works when generating png files with plot-file. This bug was introduced after Racket 8.0. Here's a quick example:

(require plot/no-gui)

(define out (open-output-file "img.png" #:exists 'replace))

(parameterize ([plot-width 800] [plot-height 300]
               [plot-background-alpha 0])
  (define xs (build-list 20 (λ _ (random))))
  (define ys (build-list 20 (λ _ (random))))
  (define pts (points (map vector xs ys)
                      #:color "black"))
  (plot-file (list pts) out 'png
             #:x-min 0 #:x-max 1
             #:y-min 0 #:y-max 1))

Please let me know if something has changed with this parameter.

Add length to ticks contract

ticks has a pretty good contract. For one, it'll catch layout functions that return bad lists:

ticks: contract violation
  expected: list?
  given: (list* (pre-tick 1673402400 #t) (pre-tick 1673614800 #t) 1673488800 #<datetime 2023-01-13T02:00:00>)
  in: the range of
      the 1st argument of
      (->
       (-> any/c any/c (listof pre-tick?))
       (-> any/c any/c any/c (listof string?))
       any)

But if the layout function returns a list of length 4 and the format function returns a list of length 2, there's an internal error:

map: all lists must have same size
  first list length: 4
  other list length: 2
  procedure: #<procedure:tick>
  context...:
   /Users/ben/code/racket/fork/racket/collects/racket/private/map.rkt:183:4: loop
   /Users/ben/code/racket/fork/racket/collects/racket/private/map.rkt:180:2: check-args
   /Users/ben/code/racket/fork/racket/collects/racket/private/map.rkt:257:2: gen-map
   /Users/ben/code/racket/fork/extra-pkgs/plot/plot-lib/plot/private/common/plot-element.rkt:25:2: default-ticks-fun
   /Users/ben/code/racket/fork/extra-pkgs/plot/plot-lib/plot/private/no-gui/plot2d-utils.rkt:51:0: get-ticks
   /Users/ben/code/racket/fork/extra-pkgs/plot/plot-lib/plot/private/no-gui/plot2d.rkt:43:0: plot/dc
   /Users/ben/code/racket/fork/extra-pkgs/plot/plot-lib/plot/private/no-gui/plot2d.rkt:171:0: plot-file
   ...cket/cmdline.rkt:191:51

Improve the contract --- or add a check.

Improve the docs for ticks-layout/c too. I wanted to return no string for minor ticks, but I guess "" is the right choice.

Arrows in drawn by the `arrow3d` are not clipped sometimes

NOTE Pull request #67 introduced the arrow and arrow3d renders

Arrows in drawn by the arrow3d are not clipped when the start is outside the plot area but the end is inside the area. This is visible in the following example: https://github.com/racket/plot/blob/master/plot-test/plot/tests/PRs/test-data/pr42-2-2.png

Source for the test data is at:

(arrows3d '((0 4 0) (2 4 0)) #:color 2 #:width 3 #:label "start OUT, end IN")

This is probably caused by the change here:

(when (and v1 v2 (or draw-outside? (in-bounds? v1)))

When the draw-outside? parameter is #t, the line arrow is drawn even if the start is outside. Note that there is a check there for the end of the arrow, and if the end is outside, the arrow drawing is replaced with put-line which presumably clips the line correctly. We need to add line clipping for the start as well.

Set plot area

It's hard to align plots with different-sized axis labels. See below -- these are equal-sized figures vl-append-ed together (code is far below)

out

Suggestions

  • Add parameters to set plot area, rather than overall plot+axis labels area
  • Add option to pad labels to a fixed width

Code

#lang racket

(require plot/pict pict racket/class)

(define (make-ticks #:multiplier [mul 1])
  (ticks (lambda (lo hi)
           (for/list ([i (in-range lo hi)])
             (pre-tick i #t)))
         (lambda (lo hi pre)
           (for/list ([pt (in-list pre)]
                      [i (in-naturals)])
             (number->string (* mul i))))))

(define (make-plot m)
  (parameterize ([plot-y-ticks (make-ticks #:multiplier m)])
  (plot-pict (function (lambda (x) x))
    #:x-min 0
    #:x-max 5
    #:y-min 0
    #:y-max 5
    #:width 90
    #:height 90)))

(define plt (vl-append 0 (make-plot 1) (make-plot 10000)))

(send (pict->bitmap plt) save-file "maligned.png" 'png)

plot-frame's frame is too small

I recently tried using plot-frame for the first time, and (at least on Mac OS) the resulting frame cuts off the plot half-way through the x-axis labels. Resizing the window causes the plot to be resized to fit correctly within the frame.

Here are a minimal example and a screenshot:

#lang racket

(require plot)

(send (plot-frame (points '((2010 39.4)
                            (2010 93.8)
                            (2011 40.3)
                            (2011 79.9)
                            (2012 44.0)
                            (2012 85.5)))
                  #:x-label "Year"
                  #:y-label "Temperature [F]")
      show
      #t)

plot-frame

Some incomplete letters in the y-label (with 'swiss font) in plot package

Running Racket 8.4 [cs], the following example program:

#lang racket
(require plot)
(parameterize
    ([plot-font-size 12]
     [plot-font-family 'swiss])
  (plot (vector-field
    (λ (x y) (vector (+ x y) (- x y)))
    -2 2 -2 2)
   #:x-label "abcdefghijklmnñopqrstuvwxyz"
   #:y-label "abcdefghijklmnñopqrstuvwxyz"))

Results in rendering the y-label, with some letters (h, n, ñ, u) incomplete.
Notice that there is no problem in the x-label letters. In other font sizes this problem may not happen.
Something similar happens with the 'decorative font.

Thank you in advance for your support, and congratulations for the great work.
Best regards.

Plot gets cut at the end

The following is the code and picture of a plot. One can see that the axis labels at y = 4 and y = -1 get cut.

Code

#lang racket
(require plot/no-gui)


(plot-x-axis? #f)
(plot-y-axis? #f)
(plot-x-far-axis? #f)
(plot-y-far-axis? #f)

(define sqrplt (plot-file (list (y-axis 0 #:labels? #t)
                           (x-axis 0 #:labels? #t)
                           (function sqr -2 2)
                           (lines (list '(-2 1) '(1 2) '(3 1)))
                           (point-label '(0 1) "Plot" #:size 24 #:color "steelblue"))
                     "sqplot.svg"
                     ))

Picture of the plot

sqplot.pdf

Thank you.

Minor typo in polar->cartesian function & verification of longitude/latitude proper use.

In the documentation of polar->cartesian function, currently it is writen:

"Converts 2D polar coordinates to 3D cartesian coordinates", but should say 2D.

Also, please verify the correctness of the following paragraph after the polar3d function documentation, concerning the ranges of latitudes and longitudes.

"Currently, latitudes range from 0 to (* 2 pi), and longitudes from (* -1/2 pi) to (* 1/2 pi). These intervals may become optional arguments to polar3d in the future."

Thank you for the excellent plot module.

Square pen cap for decorations

(edited 2020-07-03)

Currently, every line on a plot gets drawn with a round pen. This isn't always the right look. I might want tick marks to be squared off. (See crayon-drawing feeling in #48.)

Feature request: add parameters to choose the pen-cap-style/c. The "decorations" pen should be independent from the main "renderers" pen if possible.


(original issue)
Make sure that

  • extra axes
  • plot boundaries
  • tick lines
  • (other decorations)

are all drawn with the 'butt pen cap.

Also, add helpers to make hrule and vrule lines.

Add Panning

I'm not sure if this has been suggested before but would it be possible to add the ability to pan the graphs by dragging the mouse when they're zoomed in? I'm pretty sure this is a common feature and I'm surprised it's not implemented in this library (or maybe it is and I haven't found it?) Thanks!

Zoom in for error-bars (plot package) not working properly.

In version 8.2 of DrRacket (installed with: racket-8.2-x86_64-win32-cs.exe)

Running the example code for error-bars, from the (plot package) documentation.

(require plot)
(plot (list (function sqr 1 7)
              (error-bars (list (vector 2 4 12)
                                (vector 4 16 20)
                                (vector 6 36 10)))))

When we use the option: "click-and-drag to zoom", the error-bars zoom in correctly, only if we include in the zoom-window the center of the bar, otherwise it is not included in the new window.

Specially when we work with multiple functions in the same graph, it would be very good to include the (partial) error-bars, even if we don't include the centers in the selected new window.

Thank you for considering this issue.
Best regards,

Lines outside plot area

Here's the problem: sometimes the ends of lines extend past the plot area.
over-the-line
(This picture was made using plot-pict and put directly into a scribble document.)

I'd like to give a smaller example with code, but I'm having trouble reproducing the issue. I think that's because rendering a plot clips the lines.

For example here's a perfectly clipped pict:
clipped

And a seemingly-clipped blurry pict, generated by calling (compose1 bitmap pict->bitmap) on the first pict.
blurred

If picts are supposed to be unclipped, is the an easy, non-blurry way to render & clip them?

Dead code

In common/math.rkt there are multiple instances of dead code that, were it live, would be unsafe.

In both vector-ormap and vector-andmap, the final case of the case-lambda clause (for cases with more than two input vectors) is never called. If they were, the vector reference would be referencing exactly outside of the bounds of the vector. Specifically, (vector-ref xs n) where (= n (vector-length xs)) is called thrice for each definition.

Plot documents an `hline` procedure, but does not provide one

[pixels:share/pkgs] grep -R hline plot*
Binary file plot-doc/plot/scribblings/compiled/common_rkt.zo matches
Binary file plot-doc/plot/scribblings/compiled/renderer2d_scrbl.zo matches
plot-doc/plot/scribblings/renderer2d.scrbl:@defproc[(hline [y real?]

[pixels:examples/heparin] racket
Welcome to Racket v6.5.0.4.
-> (require plot)
-> hline
; hline: undefined;
;  cannot reference undefined identifier
; [,bt for context]

Continuous color legends

Currently, the legend only appears to be controllable with the #:label argument. Sometimes, however, this is not what is wanted. Namely, for example, take Figure 3.17 in socviz:
image

Due to the legend, this is not reproducible in plot, as the "color interval" effect towards the right is not controllable with just #:label (or at all, for that matter). It would be nice if this was the case.

Support markers with line plots

Various plotting tools (Excel, Matplotlib, Matlab, etc) support the use of markers in a line plot, which can then be represented in the legend. Typically these tools support markers on both symbolic and discrete data plots. For example, consider the Matlab code below:

clear
close all

syms x
f(x) = sin(x)
N = 18
x_data = linspace( 0, 2*pi, N );
y_data = sin(x_data) + ( rand(1,N) - 0.5 ) / 5;

figure
hold on
fplot( f, [0, 2*pi], LineWidth=2, LineStyle="-", Marker="o", MarkerFaceColor="w", MarkerEdgeColor="k", DisplayName="Exact" )
plot( x_data, y_data, LineWidth=2, LineStyle="-", Marker="s", MarkerFaceColor="w", MarkerEdgeColor="k", DisplayName="Test Data" )
legend()

Which produces the below plot, note that the Exact plot is a symbolic function while the Test Data is discrete.
image

Essentially, it would be nice if I could make this Racket plot replicate the behavior shown above:

#lang racket/base
(require racket/stream)
(require (only-in racket/list range) )
(require plot)
(require math)


(define (randsin x)(+ (sin x) (/ ( - (random) 0.5) 5) ) )
(define xdata (range 0 (* 2 pi) (/ pi 9 ) ) )
(define ydata (map (lambda (x) (randsin x) ) xdata ) )

(parameterize ([plot-width    400]
               [plot-height   400]
               [plot-x-label  #f]
               [plot-y-label  #f])
  (plot (list
         (function sin 0 (* 2 pi) #:label "exact" )
         (lines (map vector xdata ydata ) #:label "discrete" ) )
  )
)

image

Expose converting between plot/view/context coordinates

I'm trying to integrate plot into a larger program and need a way to take coordinates in the drawing context (I'm using plot/dc) and convert them to coordinates in the plot (and back again).

I'm aware of the word done with set-mouse-event-callback etc. but I don't think using snips makes sense for my program (I'm using lux, which just gives me a drawing context).

Support Interactive Overlays in Standalone Frames

plot-frame currently accepts only a renderer tree. it should also accept a snip, so that we can have interactive overlays in standalone frames.

while we're at it, we may as well allow the user to specify the frame title (without the "Plot: " prefix) and border width(s) as parameters.

Tick labels at the wrong place

The following code:

#lang racket
(require plot)

;; Ok plot
(list (parameterize ([plot-y-transform log-transform]
                     [plot-y-ticks (log-ticks #:number 10)])
  (plot (function exp)
        #:x-min 0. #:x-max 20
        #:height 600))

;; Wrong labels on the y axis
(parameterize ([plot-y-transform log-transform]
               [plot-y-ticks (ticks-add
                              (log-ticks #:number 10)
                              '(500))])
  (plot (function exp)
        #:x-min 0. #:x-max 20
        #:height 600)))

produces:
Screenshot from 2023-05-10 10-55-14

Observe that on the r.h.s. plot the y-tick labelled 10² is at the wrong place.

I'm not sure what's causing this. I tried changing the #:number value but the problem remains.

Large zo file sizes

Currently, many files in these packages have long compile times and very large zo file sizes, due to Typed Racket contract generation. This issue tracks reducing these problems.

In 6.11, here are the largest zo file sizes (all over 500k):

  527920 Oct 30 15:02 ./share/pkgs/htdp-lib/lang/private/compiled/beginner-funs_rkt.zo
  552840 Oct 30 15:14 ./share/pkgs/typed-racket-more/typed/mrlib/compiled/gif_rkt.zo
  559323 Oct 30 15:14 ./share/pkgs/typed-racket-more/typed/mrlib/compiled/bitmap-label_rkt.zo
  561546 Oct 30 15:14 ./share/pkgs/typed-racket-more/typed/images/compiled/logos_rkt.zo
 574192 Oct 30 15:14 ./share/pkgs/redex-benchmark/redex/benchmark/models/rvm/compiled/rvm-3_rkt.zo
 574661 Oct 30 15:14 ./share/pkgs/redex-benchmark/redex/benchmark/models/rvm/compiled/rvm-6_rkt.zo
 575781 Oct 30 15:14 ./share/pkgs/redex-benchmark/redex/benchmark/models/rvm/compiled/rvm-5_rkt.zo
 576409 Oct 30 15:14 ./share/pkgs/redex-benchmark/redex/benchmark/models/rvm/compiled/rvm-4_rkt.zo
 576831 Oct 30 15:13 ./share/pkgs/redex-benchmark/redex/benchmark/models/rvm/compiled/rvm-2_rkt.zo
 579144 Oct 30 15:13 ./share/pkgs/redex-benchmark/redex/benchmark/models/rvm/compiled/rvm-15_rkt.zo
 582794 Oct 30 15:13 ./share/pkgs/redex-benchmark/redex/benchmark/models/rvm/compiled/rvm-14_rkt.zo
  588670 Oct 30 15:08 ./share/pkgs/plot-lib/plot/private/no-gui/compiled/plot-bitmap_rkt.zo
  595188 Oct 30 15:03 ./share/pkgs/plot-lib/plot/private/common/compiled/draw-attribs_rkt.zo
  597535 Oct 30 15:05 ./share/pkgs/plot-lib/plot/private/no-gui/compiled/plot2d_rkt.zo
  602273 Oct 30 15:05 ./share/pkgs/plot-lib/plot/private/no-gui/compiled/plot2d-utils_rkt.zo
  606413 Oct 30 15:06 ./share/pkgs/plot-lib/plot/private/no-gui/compiled/plot3d_rkt.zo
  618308 Oct 30 15:06 ./share/pkgs/plot-lib/plot/private/no-gui/compiled/plot3d-utils_rkt.zo
  628042 Oct 30 15:06 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/surface_rkt.zo
  638885 Oct 30 15:07 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/line_rkt.zo
  643077 Oct 30 15:04 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/renderer_rkt.zo
  648771 Oct 30 15:04 ./share/pkgs/games/scribblings/compiled/chat-noir_scrbl.zo
  650643 Oct 30 15:03 ./share/pkgs/plot-lib/plot/private/common/compiled/draw_rkt.zo
  656339 Oct 30 15:05 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/renderer_rkt.zo
  658802 Oct 30 15:05 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/point_rkt.zo
  664922 Oct 30 15:06 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/contour_rkt.zo
  667496 Oct 30 15:06 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/rectangle_rkt.zo
  669010 Oct 30 15:07 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/decoration_rkt.zo
  669555 Oct 30 15:03 ./share/pkgs/plot-lib/plot/private/common/compiled/plot-device_rkt.zo
  670971 Oct 30 15:07 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/point_rkt.zo
  671577 Oct 30 15:04 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/plot-area_rkt.zo
  680971 Oct 30 15:07 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/rectangle_rkt.zo
  685532 Oct 30 15:02 ./share/pkgs/plot-lib/plot/private/common/compiled/types_rkt.zo
  687618 Oct 30 15:06 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/interval_rkt.zo
  689797 Oct 30 15:06 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/contour_rkt.zo
  706500 Oct 30 15:05 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/line_rkt.zo
  710123 Oct 30 15:07 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/isosurface_rkt.zo
  733293 Oct 30 15:06 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/decoration_rkt.zo
  760222 Oct 30 15:09 ./share/pkgs/typed-racket-more/typed/private/compiled/framework-types_rkt.zo
  782106 Oct 30 15:14 ./share/pkgs/typed-racket-more/typed/images/compiled/icons_rkt.zo
  837910 Oct 30 15:05 ./share/pkgs/plot-lib/plot/private/common/compiled/marching-cubes_rkt.zo
  838699 Oct 30 15:04 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/plot-area_rkt.zo
 847392 Oct 30 14:59 ./share/pkgs/gui-lib/framework/compiled/main_rkt.zo
 1110521 Oct 30 14:58 ./share/pkgs/syntax-color-lib/syntax-color/compiled/racket-lexer_rkt.zo
 1954919 Oct 30 15:10 ./share/pkgs/drracket/drracket/compiled/tool-lib_rkt.zo
 2217488 Oct 30 15:11 ./share/pkgs/racklog/tests/compiled/unit_rkt.zo
 2303470 Oct 30 15:08 ./share/pkgs/plot-gui-lib/plot/private/gui/compiled/plot2d_rkt.zo
 2312672 Oct 30 15:08 ./share/pkgs/plot-gui-lib/plot/private/gui/compiled/plot3d_rkt.zo
 2559847 Oct 30 15:09 ./share/pkgs/drracket/drracket/private/compiled/insert-large-letters_rkt.zo
 8804584 Oct 30 14:54 ./share/pkgs/web-server-lib/web-server/formlets/unsafe/compiled/input_rkt.zo

There are 49, and 29 are from various plot packages, including 2 of the 4 largest.

In a current (20180214-2e1a81b345) nightly snapshot, there is only one plot zo file over 500k, which is plot-lib/plot/private/common/marching-cubes.rkt and which is not large because of Typed Racket (changing to typed/racket/no-check doesn't affect zo file size). These reductions are due to #31 and #27 among others (also a change by @rfindler to racket/contract). Currently the largest zo sizes for plot are (all over 200k):

  209155 Feb 14 01:43 ./share/pkgs/plot-lib/plot/private/common/compiled/draw-attribs_rkt.zo
  227165 Feb 14 01:44 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/renderer_rkt.zo
  230836 Feb 14 01:46 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/surface_rkt.zo
  238563 Feb 14 01:46 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/decoration_rkt.zo
  241268 Feb 14 01:46 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/line_rkt.zo
  241524 Feb 14 01:43 ./share/pkgs/plot-lib/plot/private/common/compiled/ticks_rkt.zo
  247151 Feb 14 01:44 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/plot-area_rkt.zo
  251104 Feb 14 01:43 ./share/pkgs/plot-lib/plot/private/common/compiled/plot-device_rkt.zo
  252051 Feb 14 01:47 ./share/pkgs/plot-doc/plot/scribblings/compiled/renderer2d_scrbl.zo
  252976 Feb 14 01:43 ./share/pkgs/plot-lib/plot/private/common/compiled/types_rkt.zo
  254848 Feb 14 01:44 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/renderer_rkt.zo
  260098 Feb 14 01:45 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/contour_rkt.zo
  260599 Feb 14 01:43 ./share/pkgs/plot-lib/plot/private/common/compiled/draw_rkt.zo
  264888 Feb 14 01:46 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/point_rkt.zo
  265266 Feb 14 01:45 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/rectangle_rkt.zo
  275701 Feb 14 01:45 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/point_rkt.zo
  277213 Feb 14 01:46 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/rectangle_rkt.zo
  288376 Feb 14 01:46 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/contour_rkt.zo
  292205 Feb 14 01:45 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/interval_rkt.zo
  297586 Feb 14 01:46 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/isosurface_rkt.zo
  304001 Feb 14 01:45 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/line_rkt.zo
  307592 Feb 14 01:43 ./share/pkgs/plot-lib/plot/private/common/compiled/parameters_rkt.zo
  337916 Feb 14 01:44 ./share/pkgs/plot-lib/plot/private/plot3d/compiled/plot-area_rkt.zo
  353862 Feb 14 01:45 ./share/pkgs/plot-lib/plot/private/plot2d/compiled/decoration_rkt.zo
  837970 Feb 14 01:45 ./share/pkgs/plot-lib/plot/private/common/compiled/marching-cubes_rkt.zo

My next steps are to investigate what can be done to shrink these.

cc @stamourv @mflatt @rfindler @bennn

Cannot show anything on Win10

I ran the following three commands in racket REPL.

(require plot)
(plot-new-window? #t)
(plot (function sin (- pi) pi #:label "y = sin(x)"))

However, the window just doesn't show anthing and is like the following figure
Picture1
I have no idea what the possible issue is. I guess it might be something wrong with my computer configuration.

My racket environment:
Minimal Racket 8.9 Windows 64-bit x64
Only langserver package is downloaded through raco pkg install racket-langserver for magic racket usage in VS Code.

Any help is greatly appreciated.

`points #:sym 'circle2` raises contract error

The points renderer has an optional argument #:sym which is supposed to accept any point-sym/c.

circle2 is a point-sym/c, but points eventually blows up given that symbol. The error message is fun: "expected <one of .... circle2 ....> given circle2"

draw-glyphs: expected argument of type <one of (dot point pixel plus times asterisk 5asterisk odot oplus otimes oasterisk o5asterisk circle square diamond triangle fullcircle fullsquare fulldiamond fulltriangle triangleup triangledown triangleleft triangleright fulltriangleup fulltriangledown fulltriangleleft fulltriangleright rightarrow leftarrow uparrow downarrow 4star 5star 6star 7star 8star full4star full5star full6star full7star full8star circle1 circle2 circle3 circle4 circle5 circle6 circle7 circle8 bullet fullcircle1 fullcircle2 fullcircle3 fullcircle4 fullcircle5 fullcircle6 fullcircle7 fullcircle8)>; 
given: 'circle2
  context...:
   draw-glyphs method in plot-device%
   ...se-env/prims.rkt:743:10

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.