@@ -73,6 +73,13 @@ export async function differenceYVariable() {
73
73
} ) ;
74
74
}
75
75
76
+ export async function differenceYClip ( ) {
77
+ const gistemp = await d3 . csv < any > ( "data/gistemp.csv" , d3 . autoType ) ;
78
+ return Plot . differenceY ( gistemp , Plot . windowY ( 28 , { x : "Date" , y : "Anomaly" , clip : "frame" } ) ) . plot ( {
79
+ x : { insetLeft : - 50 }
80
+ } ) ;
81
+ }
82
+
76
83
export async function differenceYClipVariable ( ) {
77
84
const stocks = await readStocks ( ) ;
78
85
return Plot . plot ( {
@@ -90,18 +97,42 @@ export async function differenceYClipVariable() {
90
97
} ) ;
91
98
}
92
99
93
- export async function differenceYClip ( ) {
94
- const gistemp = await d3 . csv < any > ( "data/gistemp.csv" , d3 . autoType ) ;
95
- return Plot . differenceY ( gistemp , Plot . windowY ( 28 , { x : "Date" , y : "Anomaly" , clip : "frame" } ) ) . plot ( {
96
- x : { insetLeft : - 50 }
97
- } ) ;
98
- }
99
-
100
100
export async function differenceYConstant ( ) {
101
101
const aapl = await d3 . csv < any > ( "data/aapl.csv" , d3 . autoType ) ;
102
102
return Plot . differenceY ( aapl , { x : "Date" , y1 : 115 , y2 : "Close" } ) . plot ( ) ;
103
103
}
104
104
105
+ export async function differenceYOrdinal ( ) {
106
+ const random = d3 . randomLcg ( 42 ) ;
107
+ return Plot . plot ( {
108
+ marks : [
109
+ Plot . differenceY (
110
+ { length : 30 } ,
111
+ {
112
+ y1 : ( ) => "ABCDE" [ ( random ( ) * 5 ) | 0 ] ,
113
+ y2 : ( ) => "ABCDE" [ ( random ( ) * 5 ) | 0 ]
114
+ }
115
+ )
116
+ ]
117
+ } ) ;
118
+ }
119
+
120
+ export async function differenceYOrdinalFlip ( ) {
121
+ const random = d3 . randomLcg ( 42 ) ;
122
+ return Plot . plot ( {
123
+ y : { reverse : true } ,
124
+ marks : [
125
+ Plot . differenceY (
126
+ { length : 30 } ,
127
+ {
128
+ y1 : ( ) => "ABCDE" [ ( random ( ) * 5 ) | 0 ] ,
129
+ y2 : ( ) => "ABCDE" [ ( random ( ) * 5 ) | 0 ]
130
+ }
131
+ )
132
+ ]
133
+ } ) ;
134
+ }
135
+
105
136
export async function differenceYReverse ( ) {
106
137
const gistemp = await d3 . csv < any > ( "data/gistemp.csv" , d3 . autoType ) ;
107
138
return Plot . differenceY ( gistemp , Plot . windowY ( 28 , { x : "Date" , y : "Anomaly" } ) ) . plot ( { y : { reverse : true } } ) ;
0 commit comments