'Negative histogram y-values in Racket

I am trying to plot a set of values that includes both positive and negative numbers in Racket. I have tried using the discrete-histogram function from plot:

(plot 
     (discrete-histogram '(A B C) '(1.2 0.2 -0.4) 
     #:y-min -0.5))

The corresponding output doesn't plot anything for the negative value:

My Plot



Solution 1:[1]

discrete-histogram has one required argument cat-vals, so you should use '((A 1.2) (B 0.2) (C -0.4)) or (if you already have list of X values and list of Y values) (map list '(A B C) '(1.2 0.2 -0.4)):

#lang racket
(require plot)

(plot (discrete-histogram
       (map list '(A B C) '(1.2 0.2 -0.4)) 
       #:y-min -0.5))

In both cases, I see this result:

Histogram

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Martin Půda