Are you feeling jealousy towards Mathematica, Matlab et al. for their intricate plotting capabilities? If you answered yes, this challenge is for you!
Given, via parameters or standard input, a list of numbers
list and a positive integer
h for the height of the plot, write a program/function/snippet that prints a character array of
length(list) columns and
h rows, where each column contains exactly one special non-whitespace character, e.g.
h-1 spaces. For the nth column the position of the special character corresponds to the value of the nth element in the list. Lower rows correspond to lower values, so if
list[a]≥list[b], then in column
a the special character must be at least as high than in column
The scaling from the value to the y-position of the special character must essentially be an affine mapping (
x ↦ ax+b) plus any necessary rounding so for example integer division is allowed but clipping is not. The scaling must be done so that the full extent of the plot is used, i.e. the first and last row contain at least one special character.
The numbers can be of any numeral type that is at least 8 bits wide. Labels or axes aren't needed. Built-in plotting functions are allowed if the output conforms to the required format. The standard loopholes are disallowed.
list = [0.0,0.325,0.614,0.837,0.969,0.997,0.916,0.736,0.476,0.165,-0.165,-0.476,-0.736,-0.916,-0.997,-0.969,-0.837,-0.614,-0.325,0.0] h = 8
One possible output:
### ## # # # # # # # # # # ## ###
This is code-golf, so the shortest code in bytes wins!