lambdaway
::
plot4
1
|
list
|
login
|
load
|
|
_h1 [[plot]] | [[plot2]] | [[plot3]] | plot4 _ul [[http://rosettacode.org/wiki/Plot_coordinate_pairs|http://rosettacode.org/wiki/Plot_coordinate_pairs]] {pre '{def X 0 1 2 3 4 5 7 8 9} -> {def X 0 1 2 3 4 5 7 8 9} '{def Y 2.7 2.8 31.4 38.1 58.0 76.2 100.5 130.0 149.3 180.0} -> {def Y 2.7 2.8 31.4 38.1 58.0 76.2 100.5 130.0 149.3 180.0} '{def curve {lambda {:curve :kx :ky} {S.map {{lambda {:curve :kx :ky :i} {* :kx {S.get :i {{car :curve}}}} {* :ky {S.get :i {{cdr :curve}}}} } :curve :kx :ky} {S.serie 0 {- {S.length {X}} 1}} }}} -> {def curve {lambda {:curve :kx :ky} {S.map {{lambda {:curve :kx :ky :i} {* :kx {S.get :i {{car :curve}}}} {* :ky {S.get :i {{cdr :curve}}}} } :curve :kx :ky} {S.serie 0 {- {S.length {X}} 1}} }}} '{svg {@ width="580" height="300" style="background:#eee"} {g {AXES 580 300} {polyline {@ points="{curve {cons X Y} 30 0.9}" stroke="#000" fill="transparent" stroke-width="1"}} }} -> } {svg {@ width="580" height="300" style="background:#eee"} {g {AXES 580 300} {polyline {@ points="{curve {cons X Y} 30 0.9}" stroke="#000" fill="transparent" stroke-width="1"}} }} _p Using {pre '{def AXES {lambda {:w :h} {@ transform="translate({/ :w 2},{/ :h 2}) scale(1,-1)"} {line {@ x1="-{/ :w 2}:w" y1="0" x2="{/ :w 2}" y2="0" stroke="red" fill="transparent"}} {line {@ x1="0" y1="-{/ :h 2}" x2="0" y2="{/ :h 2}" stroke="green" fill="transparent"}} }} -> {def AXES {lambda {:w :h} {@ transform="translate({/ :w 2},{/ :h 2}) scale(1,-1)"} {line {@ x1="-{/ :w 2}:w" y1="0" x2="{/ :w 2}" y2="0" stroke="red" fill="transparent"}} {line {@ x1="0" y1="-{/ :h 2}" x2="0" y2="{/ :h 2}" stroke="green" fill="transparent"}} {S.map {lambda {:i} {Xs {* 30 :i} |:i}} {S.serie 0 9}} {g {@ transform="rotate(90) translate(0,12)"} {S.map {lambda {:i} {Xs {* 15 :i} |{* 25 :i}}} {S.serie 0 9 2}} } }} {def Xs {lambda {:x :t} {text {@ x=":x" y="0" dx="-3" dy="10" transform="scale(1,-1)" font-family="monaco" font-size="12px"}:t}}} {def Ys {lambda {:y :t} {text {@ x="0" y=":y" dx="-3" dy="-3" transform="scale(1,-1)" font-family="monaco" font-size="12px"}:t}}} }
lambdaway v.20211111