Image quality control using graphics / no-gui

I am using the rakcet / no-gui language library to render functions, and I would like to increase the dpi on the images produced by the plot-file call. (any style comments are also welcome)

An example function I'm drawing:

#lang racket
(require math)
(require plot/no-gui)

(plot-file (list (axes)
            (inverse-interval (λ (x) 1)
                              (λ (x) -1)
                              -3.00000 3.000000)
            (function (lambda (x) (* (expt 3 x) (sin (* 20 x)))) -1 1))
      "images/plot_000000.jpg"
      #:y-min -4
      #:y-max 4)

      

+3


source to share


1 answer


The size of the graph is controlled by the parameters plot-width

and plot-height

. The image itself has no dots per inch - your screen is mapped to dpi.

Try the following:



#lang racket
(require math)
(require plot/no-gui)

(define scale 4)
(plot-width  (* scale (plot-width))
(plot-height (* scale (plot-height))

(plot-file (list (axes)
            (inverse-interval (λ (x) 1)
                              (λ (x) -1)
                              -3.00000 3.000000)
            (function (lambda (x) (* (expt 3 x) (sin (* 20 x)))) -1 1))
      "images/plot_000000.jpg"
      #:y-min -4
      #:y-max 4)

      

+3


source







All Articles