Question update: I'm almost there, just missing dotted line style for the grid.
grid: [1100 600] step-grid: 5 max-n-points: grid/1 / step-grid x-axis-border: 20 Y-margin: 10
max-random: 1000 n-points: 300
get-random-data: func[n p][
block: copy []
repeat i n [
append block RANDOM p
]
block
]
get-extremes: func[block][
extreme: none
foreach element block [
if none? extreme [
extreme: copy []
repeat i 2 [append extreme element]
]
if element > extreme/1 [
extreme/1: element
]
if element < extreme/2 [
extreme/2: element
]
]
extreme
]
data0: get-random-data n-points max-random
extremes: get-extremes data0
height: extremes/1 - extremes/2
ratio: (grid/2 - x-axis-border - (Y-margin * 2)) / height
data: copy []
foreach element skip data0 (n-points - max-n-points) [
append data to-integer (ratio * element)
]
plot: copy []
color: 0.0.0
append plot [
pen green line
]
x: 0
foreach y data [
append plot as-pair x (grid/2 - x-axis-border - Y-margin) - y
x: x + 5
]
main: layout [
origin 20x0
space 1x1
panel1: box 1100x580 black effect reduce [
'line-pattern 4 4
'grid 30x30 0x0 200.200.200
'draw plot
]
panel2: box 1100x0 black
panel3: box 1100x20 black
]
view main
=== former question
The space between each box is too big and I cannot draw dotted grid, how to do this ?
plot: copy []
color: 0.0.0
append plot [line-pattern 4 4]
repeat x 400 [
repeat y 200 [
append plot compose [
box (xy: 25 * as-pair x - 1 y - 1) (xy + 25)
]
]
]
main: layout [
origin 0x0
panel1: box 800x400 black effect reduce ['draw plot]
panel2: box 800x180 black
panel3: box 800x20 black
]
view main