Skip to content

Commit 5b4593b

Browse files
authored
Display the smoothness slider correctly (#2257)
* Display the smoothness slider correctly * Add missing file * Add tests * Adjust style * Fix empty panels + add story
1 parent 4583a1d commit 5b4593b

File tree

5 files changed

+613
-40
lines changed

5 files changed

+613
-40
lines changed
Lines changed: 394 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,394 @@
1+
const smoothTemplatePlotContent = {
2+
$schema: 'https://vega.github.io/schema/vega-lite/v5.json',
3+
data: {
4+
values: [
5+
{
6+
timestamp: '1651815999735',
7+
step: '0',
8+
acc: '0.2712',
9+
dvc_data_version_info: {
10+
revision: 'workspace',
11+
filename: 'training_metrics/scalars/acc.tsv'
12+
},
13+
rev: 'workspace'
14+
},
15+
{
16+
timestamp: '1651816000510',
17+
step: '1',
18+
acc: '0.4104',
19+
dvc_data_version_info: {
20+
revision: 'workspace',
21+
filename: 'training_metrics/scalars/acc.tsv'
22+
},
23+
rev: 'workspace'
24+
},
25+
{
26+
timestamp: '1651816001808',
27+
step: '2',
28+
acc: '0.5052',
29+
dvc_data_version_info: {
30+
revision: 'workspace',
31+
filename: 'training_metrics/scalars/acc.tsv'
32+
},
33+
rev: 'workspace'
34+
},
35+
{
36+
timestamp: '1651816003335',
37+
step: '3',
38+
acc: '0.6678',
39+
dvc_data_version_info: {
40+
revision: 'workspace',
41+
filename: 'training_metrics/scalars/acc.tsv'
42+
},
43+
rev: 'workspace'
44+
},
45+
{
46+
timestamp: '1651816005282',
47+
step: '4',
48+
acc: '0.5457',
49+
dvc_data_version_info: {
50+
revision: 'workspace',
51+
filename: 'training_metrics/scalars/acc.tsv'
52+
},
53+
rev: 'workspace'
54+
},
55+
{
56+
timestamp: '1651816006730',
57+
step: '5',
58+
acc: '0.6654',
59+
dvc_data_version_info: {
60+
revision: 'workspace',
61+
filename: 'training_metrics/scalars/acc.tsv'
62+
},
63+
rev: 'workspace'
64+
},
65+
{
66+
timestamp: '1651816008092',
67+
step: '6',
68+
acc: '0.6689',
69+
dvc_data_version_info: {
70+
revision: 'workspace',
71+
filename: 'training_metrics/scalars/acc.tsv'
72+
},
73+
rev: 'workspace'
74+
},
75+
{
76+
timestamp: '1651816009423',
77+
step: '7',
78+
acc: '0.6841',
79+
dvc_data_version_info: {
80+
revision: 'workspace',
81+
filename: 'training_metrics/scalars/acc.tsv'
82+
},
83+
rev: 'workspace'
84+
},
85+
{
86+
timestamp: '1651816010848',
87+
step: '8',
88+
acc: '0.7325',
89+
dvc_data_version_info: {
90+
revision: 'workspace',
91+
filename: 'training_metrics/scalars/acc.tsv'
92+
},
93+
rev: 'workspace'
94+
},
95+
{
96+
timestamp: '1651816012290',
97+
step: '9',
98+
acc: '0.6935',
99+
dvc_data_version_info: {
100+
revision: 'workspace',
101+
filename: 'training_metrics/scalars/acc.tsv'
102+
},
103+
rev: 'workspace'
104+
},
105+
{
106+
timestamp: '1651816013666',
107+
step: '10',
108+
acc: '0.7514',
109+
dvc_data_version_info: {
110+
revision: 'workspace',
111+
filename: 'training_metrics/scalars/acc.tsv'
112+
},
113+
rev: 'workspace'
114+
},
115+
{
116+
timestamp: '1651816014874',
117+
step: '11',
118+
acc: '0.691',
119+
dvc_data_version_info: {
120+
revision: 'workspace',
121+
filename: 'training_metrics/scalars/acc.tsv'
122+
},
123+
rev: 'workspace'
124+
},
125+
{
126+
timestamp: '1651816016290',
127+
step: '12',
128+
acc: '0.7712',
129+
dvc_data_version_info: {
130+
revision: 'workspace',
131+
filename: 'training_metrics/scalars/acc.tsv'
132+
},
133+
rev: 'workspace'
134+
},
135+
{
136+
timestamp: '1651816017814',
137+
step: '13',
138+
acc: '0.7105',
139+
dvc_data_version_info: {
140+
revision: 'workspace',
141+
filename: 'training_metrics/scalars/acc.tsv'
142+
},
143+
rev: 'workspace'
144+
},
145+
{
146+
timestamp: '1651816018919',
147+
step: '14',
148+
acc: '0.7735',
149+
dvc_data_version_info: {
150+
revision: 'workspace',
151+
filename: 'training_metrics/scalars/acc.tsv'
152+
},
153+
rev: 'workspace'
154+
},
155+
{
156+
timestamp: '1651815999735',
157+
step: '0',
158+
acc: '0.2712',
159+
dvc_data_version_info: {
160+
revision: '208f073',
161+
filename: 'training_metrics/scalars/acc.tsv'
162+
},
163+
rev: 'smooth-plots'
164+
},
165+
{
166+
timestamp: '1651816000510',
167+
step: '1',
168+
acc: '0.4104',
169+
dvc_data_version_info: {
170+
revision: '208f073',
171+
filename: 'training_metrics/scalars/acc.tsv'
172+
},
173+
rev: 'smooth-plots'
174+
},
175+
{
176+
timestamp: '1651816001808',
177+
step: '2',
178+
acc: '0.5052',
179+
dvc_data_version_info: {
180+
revision: '208f073',
181+
filename: 'training_metrics/scalars/acc.tsv'
182+
},
183+
rev: 'smooth-plots'
184+
},
185+
{
186+
timestamp: '1651816003335',
187+
step: '3',
188+
acc: '0.6678',
189+
dvc_data_version_info: {
190+
revision: '208f073',
191+
filename: 'training_metrics/scalars/acc.tsv'
192+
},
193+
rev: 'smooth-plots'
194+
},
195+
{
196+
timestamp: '1651816005282',
197+
step: '4',
198+
acc: '0.5457',
199+
dvc_data_version_info: {
200+
revision: '208f073',
201+
filename: 'training_metrics/scalars/acc.tsv'
202+
},
203+
rev: 'smooth-plots'
204+
},
205+
{
206+
timestamp: '1651816006730',
207+
step: '5',
208+
acc: '0.6654',
209+
dvc_data_version_info: {
210+
revision: '208f073',
211+
filename: 'training_metrics/scalars/acc.tsv'
212+
},
213+
rev: 'smooth-plots'
214+
},
215+
{
216+
timestamp: '1651816008092',
217+
step: '6',
218+
acc: '0.6689',
219+
dvc_data_version_info: {
220+
revision: '208f073',
221+
filename: 'training_metrics/scalars/acc.tsv'
222+
},
223+
rev: 'smooth-plots'
224+
},
225+
{
226+
timestamp: '1651816009423',
227+
step: '7',
228+
acc: '0.6841',
229+
dvc_data_version_info: {
230+
revision: '208f073',
231+
filename: 'training_metrics/scalars/acc.tsv'
232+
},
233+
rev: 'smooth-plots'
234+
},
235+
{
236+
timestamp: '1651816010848',
237+
step: '8',
238+
acc: '0.7325',
239+
dvc_data_version_info: {
240+
revision: '208f073',
241+
filename: 'training_metrics/scalars/acc.tsv'
242+
},
243+
rev: 'smooth-plots'
244+
},
245+
{
246+
timestamp: '1651816012290',
247+
step: '9',
248+
acc: '0.6935',
249+
dvc_data_version_info: {
250+
revision: '208f073',
251+
filename: 'training_metrics/scalars/acc.tsv'
252+
},
253+
rev: 'smooth-plots'
254+
},
255+
{
256+
timestamp: '1651816013666',
257+
step: '10',
258+
acc: '0.7514',
259+
dvc_data_version_info: {
260+
revision: '208f073',
261+
filename: 'training_metrics/scalars/acc.tsv'
262+
},
263+
rev: 'smooth-plots'
264+
},
265+
{
266+
timestamp: '1651816014874',
267+
step: '11',
268+
acc: '0.691',
269+
dvc_data_version_info: {
270+
revision: '208f073',
271+
filename: 'training_metrics/scalars/acc.tsv'
272+
},
273+
rev: 'smooth-plots'
274+
},
275+
{
276+
timestamp: '1651816016290',
277+
step: '12',
278+
acc: '0.7712',
279+
dvc_data_version_info: {
280+
revision: '208f073',
281+
filename: 'training_metrics/scalars/acc.tsv'
282+
},
283+
rev: 'smooth-plots'
284+
},
285+
{
286+
timestamp: '1651816017814',
287+
step: '13',
288+
acc: '0.7105',
289+
dvc_data_version_info: {
290+
revision: '208f073',
291+
filename: 'training_metrics/scalars/acc.tsv'
292+
},
293+
rev: 'smooth-plots'
294+
},
295+
{
296+
timestamp: '1651816018919',
297+
step: '14',
298+
acc: '0.7735',
299+
dvc_data_version_info: {
300+
revision: '208f073',
301+
filename: 'training_metrics/scalars/acc.tsv'
302+
},
303+
rev: 'smooth-plots'
304+
}
305+
]
306+
},
307+
title: 'training_metrics/scalars/acc.tsv',
308+
width: 300,
309+
height: 300,
310+
params: [
311+
{
312+
name: 'smooth',
313+
value: 0.2,
314+
bind: { input: 'range', min: 0.001, max: 1, step: 0.01 }
315+
}
316+
],
317+
transform: [
318+
{
319+
loess: 'acc',
320+
on: 'step',
321+
groupby: ['rev'],
322+
bandwidth: { signal: 'smooth' }
323+
}
324+
],
325+
layer: [
326+
{
327+
encoding: {
328+
x: { field: 'step', type: 'quantitative', title: 'step' },
329+
y: {
330+
field: 'acc',
331+
type: 'quantitative',
332+
title: 'acc',
333+
scale: { zero: false }
334+
},
335+
color: { field: 'rev', type: 'nominal' }
336+
},
337+
layer: [
338+
{ mark: 'line' },
339+
{
340+
selection: {
341+
label: {
342+
type: 'single',
343+
nearest: true,
344+
on: 'mouseover',
345+
encodings: ['x'],
346+
empty: 'none',
347+
clear: 'mouseout'
348+
}
349+
},
350+
mark: 'point',
351+
encoding: {
352+
opacity: {
353+
condition: { selection: 'label', value: 1 },
354+
value: 0
355+
}
356+
}
357+
}
358+
]
359+
},
360+
{
361+
transform: [{ filter: { selection: 'label' } }],
362+
layer: [
363+
{
364+
mark: { type: 'rule', color: 'gray' },
365+
encoding: { x: { field: 'step', type: 'quantitative' } }
366+
},
367+
{
368+
encoding: {
369+
text: { type: 'quantitative', field: 'acc' },
370+
x: { field: 'step', type: 'quantitative' },
371+
y: { field: 'acc', type: 'quantitative' }
372+
},
373+
layer: [
374+
{
375+
mark: { type: 'text', align: 'left', dx: 5, dy: -5 },
376+
encoding: { color: { type: 'nominal', field: 'rev' } }
377+
}
378+
]
379+
}
380+
]
381+
}
382+
],
383+
encoding: {
384+
color: {
385+
legend: { disable: true },
386+
scale: {
387+
domain: ['workspace', 'smooth-plots'],
388+
range: ['#945dd6', '#13adc7']
389+
}
390+
}
391+
}
392+
}
393+
394+
export default smoothTemplatePlotContent

0 commit comments

Comments
 (0)