Liking cljdoc? Tell your friends :D

bytemap.plot


histogramclj/s

(histogram canvas bins & {:keys [orientation] :or {orientation :vertical}})

Plots a map as a histogram on a canvas.

Arguments:

  • canvas: A canvas
  • bins: A map where the values are numbers (e.g. the output of clojure.core/frequencies). Iteration order of bins determines bar order (left-to-right for :vertical, top-to-bottom for :horizontal) — pass a sorted-map for a meaningful ordering.

Options:

  • :orientation - Whether to draw the histogram with :vertical or :horizontal bars (default: :vertical)

Bar heights (or widths, for :horizontal) are scaled relative to the largest value in bins. If bins has more entries than there are subpixel columns (:vertical) or rows (:horizontal) available on the canvas, it is downsampled via bytemap.util/downsample-histogram into exactly that many bars, each a weighted average over the corresponding fractional span of input bins — the original bin keys are not retained in that case.

Returns the new canvas.

Plots a map as a histogram on a canvas.

Arguments:
- canvas: A canvas
- bins: A map where the values are numbers (e.g. the output of clojure.core/frequencies).
        Iteration order of `bins` determines bar order (left-to-right for
        :vertical, top-to-bottom for :horizontal) — pass a sorted-map for a
        meaningful ordering.

Options:
- :orientation - Whether to draw the histogram with :vertical or :horizontal bars (default: :vertical)

Bar heights (or widths, for :horizontal) are scaled relative to the largest
value in `bins`. If `bins` has more entries than there are subpixel columns
(:vertical) or rows (:horizontal) available on the canvas, it is downsampled
via `bytemap.util/downsample-histogram` into exactly that many bars, each a
weighted average over the corresponding fractional span of input bins — the
original bin keys are not retained in that case.

Returns the new canvas.
sourceraw docstring

plotclj/s

(plot canvas
      f
      &
      {:keys [axis x-scale y-scale] :or {axis true x-scale 1 y-scale 1}})

Plots a mathematical function on a canvas.

Arguments:

  • canvas: A canvas
  • f: Function to plot (takes a number, returns a number)

Options:

  • :axis - Whether to draw x and y axes (default: true)
  • :x-scale: The range of x values (from -x-scale to +x-scale) (default: 1)
  • :y-scale: The range of y values (from -y-scale to +y-scale) (default: 1)

The function is sampled at regular intervals across the canvas width, and consecutive points are connected with lines.

Returns the new canvas.

Plots a mathematical function on a canvas.

Arguments:
- canvas: A canvas
- f: Function to plot (takes a number, returns a number)

Options:
- :axis - Whether to draw x and y axes (default: true)
- :x-scale: The range of x values (from -x-scale to +x-scale) (default: 1)
- :y-scale: The range of y values (from -y-scale to +y-scale) (default: 1)

The function is sampled at regular intervals across the canvas width,
and consecutive points are connected with lines.

Returns the new canvas.
sourceraw docstring

plot->stringclj/s

(plot->string f [w h] x-scale y-scale & {:keys [axis] :or {axis true}})

Convenience function that plots a mathematical function and returns the string representation.

Arguments:

  • f: Function to plot (takes a number, returns a number)
  • [w h]: schema/Canvas dimensions in pixels
  • x-scale: The range of x values (from -x-scale to +x-scale)
  • y-scale: The range of y values (from -y-scale to +y-scale)

Options:

  • :axis - Whether to draw x and y axes (default: true)
Convenience function that plots a mathematical function and returns the string representation.

Arguments:
- f: Function to plot (takes a number, returns a number)
- [w h]: schema/Canvas dimensions in pixels
- x-scale: The range of x values (from -x-scale to +x-scale)
- y-scale: The range of y values (from -y-scale to +y-scale)

Options:
- :axis - Whether to draw x and y axes (default: true)
sourceraw docstring

plot-histogramclj/s

(plot-histogram xs
                &
                {:keys [w h stats orientation]
                 :or {orientation :vertical stats true}})

Plots and prints a histogram on a new canvas.

Plots and prints a histogram on a new canvas.
sourceraw docstring

(print-plot! f [w h] x-scale y-scale & {:keys [axis] :or {axis true}})

Convenience function that plots a mathematical function on a new canvas and prints it.

Arguments:

  • f: Function to plot (takes a number, returns a number)
  • [w h]: schema/Canvas dimensions in pixels
  • x-scale: The range of x values (from -x-scale to +x-scale)
  • y-scale: The range of y values (from -y-scale to +y-scale)

Options:

  • :axis - Whether to draw x and y axes (default: true)
Convenience function that plots a mathematical function on a new canvas and prints it.

Arguments:
- f: Function to plot (takes a number, returns a number)
- [w h]: schema/Canvas dimensions in pixels
- x-scale: The range of x values (from -x-scale to +x-scale)
- y-scale: The range of y values (from -y-scale to +y-scale)

Options:
- :axis - Whether to draw x and y axes (default: true)
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close