-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot-builder.html
More file actions
531 lines (484 loc) · 40.1 KB
/
Copy pathplot-builder.html
File metadata and controls
531 lines (484 loc) · 40.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
<!DOCTYPE html>
<html lang="en" class="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Publication Plot Builder | Layer & Export SVG | STEMKit</title>
<meta name="title" content="Publication Plot Builder | Layer & Export SVG | STEMKit">
<meta name="description" content="Build publication-ready plots directly in your browser. Layer multiple CSV datasets, customize axes, and export to SVG or high-res PNG without writing Python code.">
<meta name="keywords" content="scientific plotting, multi-dataset graph, browser originlab alternative, plotly csv, export svg plot, STEMKit graphing">
<link rel="canonical" href="https://stemkit.net/plot-builder.html">
<meta property="og:url" content="https://stemkit.net/plot-builder.html">
<meta property="twitter:url" content="https://stemkit.net/plot-builder.html">
<meta property="og:title" content="Publication Plot Builder | Layer & Export SVG">
<meta property="twitter:title" content="Publication Plot Builder | Layer & Export SVG">
<meta property="og:description" content="Visually layer multiple datasets and export publication-ready SVG graphics instantly.">
<meta property="twitter:description" content="Visually layer multiple datasets and export publication-ready SVG graphics instantly.">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "STEMKit Plot Builder",
"url": "https://stemkit.net/plot-builder.html",
"description": "Visually layer datasets and export publication-ready SVG graphics.",
"applicationCategory": "DesignApplication",
"operatingSystem": "All",
"browserRequirements": "Requires JavaScript",
"offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" },
"featureList": [ "Vector SVG Export", "Multi-dataset Layering", "Custom Axis Scaling", "100% Client-Side Rendering" ]
}
</script>
<meta name="author" content="STEMKit">
<meta name="theme-color" content="#4f46e5">
<meta property="og:type" content="website">
<meta property="og:image" content="https://stemkit.net/assets/og-image.webp">
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:image" content="https://stemkit.net/assets/og-image.webp">
<link rel="icon" type="image/x-icon" href="https://stemkit.net/assets/favicon.ico">
<link rel="icon" type="image/png" sizes="32x32" href="https://stemkit.net/assets/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="https://stemkit.net/assets/favicon-16x16.png">
<link rel="apple-touch-icon" href="https://stemkit.net/assets/apple-touch-icon.png">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/all.min.css">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/all.min.css">
<script src="js/dependencies/papaparse.min.js"></script>
<script src="js/dependencies/plotly.min.js"></script>
<style>
@keyframes slideIn { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast-enter { animation: slideIn 0.3s forwards; }
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
.pb-lbl { display:flex; flex-direction:column; gap:.2rem; font-size:.68rem; font-weight:600; color:#64748b; min-width:0; }
.dark .pb-lbl { color:#94a3b8; }
.pb-lbl b { color:#4f46e5; font-weight:700; }
.dark .pb-lbl b { color:#a5b4fc; }
.pb-input { font-size:.75rem; font-weight:500; padding:.3rem .45rem; border-radius:.45rem; color:#1e293b;
background:#f8fafc; border:1px solid #e2e8f0; outline:none; }
.pb-input:focus { border-color:#6366f1; }
.dark .pb-input { background:#0f172a; border-color:#334155; color:#e2e8f0; }
.pb-range { width:100%; accent-color:#6366f1; }
#codeModal.open { display:flex; }
.pb-sample-btn { display:inline-flex; align-items:center; gap:.4rem; font-size:.72rem; font-weight:700;
padding:.35rem .7rem; border-radius:.5rem; cursor:pointer; color:#4338ca; background:#eef2ff;
border:1px solid #c7d2fe; transition:all .15s; }
.pb-sample-btn:hover { background:#4f46e5; color:#fff; border-color:#4f46e5; }
.dark .pb-sample-btn { color:#c7d2fe; background:rgba(49,46,129,.4); border-color:#4338ca; }
.dark .pb-sample-btn:hover { background:#4f46e5; color:#fff; }
.stk-section { padding: 3rem 0; border-top: 1px solid rgba(148,163,184,.2); }
.stk-wrap { max-width: 80rem; margin: 0 auto; padding-left: 1.5rem; padding-right: 1.5rem; }
.stk-chip { display:inline-flex; align-items:center; gap:.45rem; font-size:.68rem; font-weight:800;
text-transform:uppercase; letter-spacing:.12em; padding:.3rem .7rem; border-radius:9999px;
background:#eef2ff; color:#4338ca; border:1px solid #e0e7ff; }
.dark .stk-chip { background:rgba(67,56,202,.18); color:#a5b4fc; border-color:rgba(99,102,241,.3); }
.stk-h2 { font-size:1.6rem; font-weight:800; letter-spacing:-.02em; margin:.75rem 0 .5rem; }
.stk-lead { max-width:48rem; color:#64748b; line-height:1.6; }
.dark .stk-lead { color:#94a3b8; }
.stk-grid { display:grid; gap:1rem; grid-template-columns:1fr; margin-top:1.5rem; }
@media (min-width:768px){ .stk-grid-3{grid-template-columns:repeat(3,1fr);} .stk-grid-2{grid-template-columns:repeat(2,1fr);} }
.stk-card { border-radius:1rem; border:1px solid rgba(148,163,184,.25); padding:1.4rem; background:#fff; }
.dark .stk-card { background:#0f172a; border-color:rgba(51,65,85,.8); }
.stk-step { display:flex; gap:.85rem; align-items:flex-start; }
.stk-num { width:2rem; height:2rem; border-radius:9999px; display:inline-flex; align-items:center;
justify-content:center; font-weight:800; font-size:.85rem; flex-shrink:0;
background:#4f46e5; color:#fff; }
.stk-step h3 { font-weight:700; font-size:.95rem; margin-bottom:.15rem; }
.stk-step p { font-size:.85rem; color:#64748b; line-height:1.5; }
.dark .stk-step p { color:#94a3b8; }
.stk-note { display:flex; gap:.6rem; align-items:flex-start; font-size:.82rem; line-height:1.55;
background:#fffbeb; border:1px solid #fde68a; color:#92400e; border-radius:.75rem; padding:.9rem 1rem; }
.dark .stk-note { background:rgba(120,53,15,.15); border-color:rgba(180,83,9,.4); color:#fcd34d; }
.stk-faq { border-bottom:1px solid rgba(148,163,184,.22); }
.stk-faq > summary { list-style:none; cursor:pointer; padding:1rem 0; font-weight:600; font-size:.95rem;
display:flex; justify-content:space-between; align-items:center; gap:1rem; }
.stk-faq > summary::-webkit-details-marker { display:none; }
.stk-faq > summary::after { content:"+"; font-weight:700; color:#6366f1; font-size:1.2rem; line-height:1; }
.stk-faq[open] > summary::after { content:"\2212"; }
.stk-faq > div { padding:0 0 1.1rem; font-size:.88rem; line-height:1.6; color:#475569; }
.dark .stk-faq > div { color:#94a3b8; }
.stk-refs { display:flex; flex-wrap:wrap; gap:.6rem; margin-top:1rem; }
.stk-refs a { display:inline-flex; align-items:center; gap:.4rem; font-size:.82rem; font-weight:600;
color:#4f46e5; text-decoration:none; border:1px solid #e0e7ff; background:#eef2ff;
padding:.4rem .8rem; border-radius:.6rem; }
.dark .stk-refs a { color:#a5b4fc; background:rgba(67,56,202,.15); border-color:rgba(99,102,241,.3); }
.stk-refs a:hover { text-decoration:underline; }
.stk-byline { font-size:.8rem; color:#94a3b8; margin-top:.35rem; }
.stk-credit { margin-top:2rem; font-size:.8rem; color:#94a3b8; }
/* Method & equations (MathML) */
.stk-math { overflow-x:auto; padding:1rem 1.1rem; margin:.6rem 0 1rem; border:1px solid rgba(148,163,184,.25);
border-radius:.75rem; background:#f8fafc; font-size:1.15rem; }
.dark .stk-math { background:#0f172a; }
.stk-math math { color:inherit; }
.stk-eqn-label { font-size:.9rem; font-weight:600; color:#475569; margin-top:1.1rem; }
.dark .stk-eqn-label { color:#cbd5e1; }
.stk-where { font-size:.85rem; color:#64748b; line-height:1.75; margin-top:.5rem; }
.dark .stk-where { color:#94a3b8; }
.stk-model-list { list-style:none; padding:0; margin:.6rem 0 0; display:grid; gap:.55rem; }
.stk-model-list li { font-size:.92rem; display:flex; gap:.6rem; align-items:center; flex-wrap:wrap; }
.stk-model-list b { min-width:9rem; color:#475569; font-weight:600; }
.dark .stk-model-list b { color:#cbd5e1; }
.stk-refs-h { font-weight:700; font-size:1rem; margin-top:1.9rem; margin-bottom:.5rem; }
.stk-refs-list { font-size:.82rem; color:#64748b; line-height:1.75; padding-left:1.2rem; }
.dark .stk-refs-list { color:#94a3b8; }
.stk-refs-list li { margin-bottom:.45rem; }
.stk-refs-list a { color:#4f46e5; text-decoration:none; }
.dark .stk-refs-list a { color:#a5b4fc; }
.stk-refs-list a:hover { text-decoration:underline; }
</style>
<link rel="stylesheet" href="src/home.css">
<link rel="stylesheet" href="src/output.css">
</head>
<body class="bg-slate-50 dark:bg-slate-950 text-slate-900 dark:text-slate-100 min-h-screen flex flex-col transition-colors duration-300 overflow-x-hidden">
<nav class="sticky top-0 z-50 w-full bg-white/80 dark:bg-slate-950/80 backdrop-blur-md border-b border-slate-200 dark:border-slate-800 transition-colors duration-300 flex-shrink-0">
<div class="max-w-[1600px] mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between items-center h-16 sm:h-20">
<a href="index.html" class="flex items-center gap-2 hover:opacity-80 transition-opacity">
<div class="bg-indigo-600 text-white p-2 sm:p-2.5 rounded-lg shadow-sm flex items-center justify-center">
<i class="fa-solid fa-flask text-lg sm:text-xl"></i>
</div>
<span class="text-xl sm:text-2xl font-black tracking-tighter text-slate-900 dark:text-white">STEMKit</span>
</a>
<div class="hidden md:flex items-center gap-6 text-sm font-semibold text-slate-600 dark:text-slate-300">
<a href="index.html#data-tools" class="hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors">Data</a>
<a href="index.html#comp-tools" class="hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors">Compute</a>
<a href="index.html#pub-tools" class="hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors">Writing & Citations</a>
<a href="index.html#focus-tools" class="hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors">Focus</a>
<div class="h-5 w-px bg-slate-200 dark:bg-slate-700"></div>
<button class="themeToggle p-2 rounded-full hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors" aria-label="Toggle dark mode">
<i class="fa-solid fa-moon dark:hidden text-lg"></i>
<i class="fa-solid fa-sun hidden dark:block text-yellow-400 text-lg"></i>
</button>
<a href="plot-digitizer.html" class="bg-indigo-600 hover:bg-indigo-700 text-white px-5 py-2.5 rounded-full text-sm font-bold transition-all shadow-md hover:shadow-lg">
<i class="fa-solid fa-crosshairs mr-1"></i> Plot Digitizer
</a>
</div>
<div class="flex items-center gap-2 md:hidden">
<button class="themeToggle p-2 rounded-full hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors text-slate-600 dark:text-slate-300">
<i class="fa-solid fa-moon dark:hidden text-lg"></i>
<i class="fa-solid fa-sun hidden dark:block text-yellow-400 text-lg"></i>
</button>
<button id="mobile-menu-btn" class="text-slate-600 dark:text-slate-300 hover:text-indigo-600 p-2 focus:outline-none">
<i class="fa-solid fa-bars text-2xl" id="menu-icon"></i>
</button>
</div>
</div>
</div>
<div id="mobile-menu" class="hidden md:hidden bg-white/95 dark:bg-slate-900/95 backdrop-blur-md border-b border-slate-200 dark:border-slate-800 absolute w-full shadow-xl">
<div class="px-4 pt-2 pb-6 space-y-2 text-base font-semibold text-slate-600 dark:text-slate-300">
<a href="index.html#data-tools" class="mobile-link block py-3 px-4 rounded-xl hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-indigo-600 transition-colors">Data & Stats</a>
<a href="index.html#comp-tools" class="mobile-link block py-3 px-4 rounded-xl hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-indigo-600 transition-colors">Compute</a>
<a href="index.html#pub-tools" class="mobile-link block py-3 px-4 rounded-xl hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-indigo-600 transition-colors">Writing & Citations</a>
<a href="index.html#focus-tools" class="mobile-link block py-3 px-4 rounded-xl hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-indigo-600 transition-colors">Focus & Flow</a>
<div class="pt-4 mt-2 border-t border-slate-100 dark:border-slate-800">
<a href="plot-digitizer.html" class="block text-center bg-indigo-600 hover:bg-indigo-700 text-white py-3 rounded-xl shadow-md transition-colors">Digitizer Pro</a>
</div>
</div>
</div>
</nav>
<div class="flex-grow w-full flex flex-col relative" style="height: calc(100vh - 80px);">
<main class="stk-shell flex-grow max-w-[1600px] mx-auto px-4 py-6 w-full flex flex-col lg:flex-row gap-6">
<aside class="stk-shell-pane w-full lg:w-[450px] flex flex-col gap-6 lg:pr-2 pb-8 scrollbar-hide flex-shrink-0">
<div class="bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-800 rounded-2xl p-5 shadow-sm">
<h2 class="text-base font-bold mb-3 flex items-center justify-between">
<span>1. Data pool</span>
<span class="text-xs font-normal text-slate-500 bg-slate-100 dark:bg-slate-800 px-2 py-1 rounded">CSV format</span>
</h2>
<div id="uploadZone" class="border-2 border-dashed border-indigo-300 dark:border-indigo-700 rounded-xl bg-indigo-50/50 dark:bg-indigo-900/10 hover:bg-indigo-50 dark:hover:bg-indigo-900/20 transition-all cursor-pointer p-4 text-center group">
<input type="file" id="fileInput" accept=".csv" multiple class="hidden">
<p class="text-sm font-medium text-slate-600 dark:text-slate-300"><i class="fa-solid fa-file-csv mr-1 text-indigo-500"></i> Drop files or click to add</p>
</div>
<div class="mt-2 text-center">
<button id="loadSampleBtn" class="pb-sample-btn"><i class="fa-solid fa-flask-vial"></i> Load sample dataset</button>
</div>
<div id="fileInventory" class="mt-3 flex flex-col gap-2 empty:hidden"></div>
</div>
<div id="datasetContainer" class="flex flex-col gap-4 hidden">
<div class="flex justify-between items-center">
<h2 class="text-base font-bold">2. Active traces</h2>
<button id="addTraceBtn" class="text-xs font-bold text-indigo-600 dark:text-indigo-400 hover:text-indigo-800 dark:hover:text-indigo-300 transition-colors">
<i class="fa-solid fa-plus mr-1"></i> Add trace
</button>
</div>
<div id="traceList" class="flex flex-col gap-3"></div>
</div>
<div class="bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-800 rounded-2xl p-5 shadow-sm">
<h2 class="text-base font-bold mb-4">3. Aesthetics & layout</h2>
<div class="flex flex-col gap-4">
<div>
<label class="block text-[11px] font-bold text-slate-500 uppercase tracking-wider mb-1">Titles</label>
<input type="text" id="plotTitle" class="w-full bg-slate-50 dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-lg px-3 py-2 text-sm outline-none focus:border-indigo-500 mb-2" placeholder="Main Plot Title">
<div class="grid grid-cols-2 gap-2">
<input type="text" id="xAxisLabel" class="w-full bg-slate-50 dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-lg px-3 py-2 text-sm outline-none focus:border-indigo-500" placeholder="X-Axis Label">
<input type="text" id="yAxisLabel" class="w-full bg-slate-50 dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-lg px-3 py-2 text-sm outline-none focus:border-indigo-500" placeholder="Y-Axis Label">
</div>
</div>
<div class="grid grid-cols-2 gap-4 border-t border-slate-100 dark:border-slate-800 pt-4">
<div>
<label class="block text-[11px] font-bold text-slate-500 uppercase tracking-wider mb-2">Axes & grid</label>
<label class="flex items-center gap-2 text-sm cursor-pointer mb-2">
<input type="checkbox" id="showFrame" class="rounded text-indigo-600" checked> Boxed frame
</label>
<label class="flex items-center gap-2 text-sm cursor-pointer mb-2">
<input type="checkbox" id="showGridX" class="rounded text-indigo-600"> Inner X grid
</label>
<label class="flex items-center gap-2 text-sm cursor-pointer">
<input type="checkbox" id="showGridY" class="rounded text-indigo-600"> Inner Y grid
</label>
</div>
<div>
<label class="block text-[11px] font-bold text-slate-500 uppercase tracking-wider mb-2">Scale & ticks</label>
<label class="flex items-center gap-2 text-sm cursor-pointer mb-2">
<input type="checkbox" id="xLogScale" class="rounded text-indigo-600"> X log scale
</label>
<label class="flex items-center gap-2 text-sm cursor-pointer mb-3">
<input type="checkbox" id="yLogScale" class="rounded text-indigo-600"> Y log scale
</label>
<select id="tickStyle" class="w-full bg-slate-50 dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-lg px-2 py-1 text-xs outline-none focus:border-indigo-500">
<option value="inside">Ticks: Inside</option>
<option value="outside">Ticks: Outside</option>
<option value="">Ticks: Hidden</option>
</select>
</div>
</div>
<div class="border-t border-slate-100 dark:border-slate-800 pt-4">
<label class="block text-[11px] font-bold text-slate-500 uppercase tracking-wider mb-2">Legend configuration</label>
<select id="legendPosition" class="w-full bg-slate-50 dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-lg px-3 py-2 text-sm outline-none focus:border-indigo-500">
<option value="top-right">Inner Top Right</option>
<option value="top-left">Inner Top Left</option>
<option value="bottom-right">Inner Bottom Right</option>
<option value="outside">Outside Right</option>
<option value="hidden">Hidden</option>
</select>
</div>
<div class="border-t border-slate-100 dark:border-slate-800 pt-4">
<label class="block text-[11px] font-bold text-slate-500 uppercase tracking-wider mb-2">Typography & style</label>
<div class="grid grid-cols-2 gap-2 mb-2 min-w-0">
<label class="pb-lbl">Font family
<select id="fontFamily" class="pb-input">
<option value="Inter, system-ui, sans-serif">Inter (sans)</option>
<option value="Georgia, 'Times New Roman', serif">Serif</option>
<option value="'Courier New', monospace">Monospace</option>
<option value="Arial, sans-serif">Arial</option>
<option value="Helvetica, Arial, sans-serif">Helvetica</option>
</select>
</label>
<label class="pb-lbl">Color theme
<select id="colorTheme" class="pb-input">
<option value="auto">Match app</option>
<option value="light">Light (print)</option>
<option value="dark">Dark</option>
</select>
</label>
<label class="pb-lbl">Title size <b id="titleSizeVal">18</b>
<input id="titleSize" type="range" min="10" max="32" value="18" class="pb-range">
</label>
<label class="pb-lbl">Axis label size <b id="axisSizeVal">14</b>
<input id="axisSize" type="range" min="8" max="24" value="14" class="pb-range">
</label>
<label class="pb-lbl">Tick size <b id="tickSizeVal">12</b>
<input id="tickSize" type="range" min="6" max="20" value="12" class="pb-range">
</label>
<label class="pb-lbl">Marker size <b id="markerSizeVal">6</b>
<input id="markerSize" type="range" min="2" max="16" value="6" class="pb-range">
</label>
<label class="pb-lbl">Line width <b id="lineWidthVal">2</b>
<input id="lineWidth" type="range" min="1" max="8" value="2" class="pb-range">
</label>
<label class="pb-lbl">Grid opacity <b id="gridOpacityVal">100</b>%
<input id="gridOpacity" type="range" min="0" max="100" value="100" class="pb-range">
</label>
</div>
</div>
<div class="border-t border-slate-100 dark:border-slate-800 pt-4">
<label class="block text-[11px] font-bold text-slate-500 uppercase tracking-wider mb-2">Export dimensions</label>
<div class="grid grid-cols-3 gap-2 min-w-0">
<label class="pb-lbl">Width px
<input id="exportWidth" type="number" value="1200" min="200" max="5000" class="pb-input">
</label>
<label class="pb-lbl">Height px
<input id="exportHeight" type="number" value="800" min="200" max="5000" class="pb-input">
</label>
<label class="pb-lbl">Scale (DPI)
<select id="exportScale" class="pb-input">
<option value="1">1×</option>
<option value="2" selected>2×</option>
<option value="3">3×</option>
<option value="4">4×</option>
</select>
</label>
</div>
</div>
</div>
<button id="updatePlotBtn" class="bg-slate-900 dark:bg-indigo-600 text-white w-full py-3 rounded-xl font-bold transition-all duration-150 shadow-sm hover:shadow-md active:scale-[0.98] focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-slate-950 mt-6 flex items-center justify-center gap-2">
<i class="fa-solid fa-chart-line text-sm"></i> Render Graph
</button>
</div>
</aside>
<section class="stk-shell-main flex-grow flex flex-col bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-800 rounded-2xl shadow-sm overflow-hidden h-[70vh] lg:h-full">
<div class="bg-slate-50 dark:bg-slate-900 border-b border-slate-200 dark:border-slate-800 p-4 flex justify-between items-center z-10 flex-shrink-0">
<h2 class="text-sm font-bold text-slate-700 dark:text-slate-300">Plot viewport</h2>
<div class="flex gap-2">
<button id="copyPyBtn" class="px-3 py-1.5 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-md text-xs font-semibold hover:text-indigo-600 transition-colors shadow-sm" title="Copy matplotlib code to reproduce this figure">
<i class="fa-brands fa-python mr-1"></i> Python
</button>
<button id="downloadSvgBtn" class="px-3 py-1.5 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-md text-xs font-semibold hover:text-indigo-600 transition-colors shadow-sm">
<i class="fa-solid fa-download mr-1"></i> SVG
</button>
<button id="downloadPngBtn" class="px-3 py-1.5 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-md text-xs font-semibold hover:text-indigo-600 transition-colors shadow-sm">
<i class="fa-solid fa-download mr-1"></i> PNG
</button>
</div>
</div>
<div id="plotlyCanvas" class="flex-grow w-full relative">
<div id="emptyPlotState" class="absolute inset-0 flex flex-col items-center justify-center text-slate-400">
<i class="fa-solid fa-chart-line text-6xl mb-4 opacity-20" aria-hidden="true"></i>
<p class="font-medium">Upload datasets and add traces to begin</p>
</div>
</div>
</section>
</main>
<div class="stk-wrap">
<section class="stk-section" id="how-to-use" aria-label="How to use this tool">
<span class="stk-chip"><i class="fa-solid fa-circle-play"></i> Guide</span>
<h2 class="stk-h2">How to build a figure</h2>
<p class="stk-lead">Combine one or more CSV datasets into a single publication-quality plot, style every detail, then export as PNG/SVG or copy the matplotlib code to reproduce it in Python.</p>
<div class="stk-grid stk-grid-2" style="margin-top:1.5rem;">
<div class="stk-step"><span class="stk-num">1</span><div><h3>Add data</h3><p>Drop one or more CSV files (each needs a header row and at least two columns), or click <strong>Load sample dataset</strong> to try it instantly.</p></div></div>
<div class="stk-step"><span class="stk-num">2</span><div><h3>Define traces</h3><p>Each trace maps a file's X column against a Y column. Add multiple traces (even from different files) to overlay them, and set each one's name, colour and style.</p></div></div>
<div class="stk-step"><span class="stk-num">3</span><div><h3>Style it</h3><p>Set titles and axis labels, toggle log scales, gridlines and the boxed frame, then fine-tune typography, marker/line sizes and the legend in <em>Typography & style</em>.</p></div></div>
<div class="stk-step"><span class="stk-num">4</span><div><h3>Export or reproduce</h3><p>Set export width/height/scale, then download <strong>PNG</strong> or <strong>SVG</strong>. Or click <strong>Python</strong> to copy runnable matplotlib code that recreates the figure from your data.</p></div></div>
</div>
</section>
<section class="stk-section" id="how-it-works" aria-label="Notes on good figures">
<span class="stk-chip"><i class="fa-solid fa-lightbulb"></i> Good practice</span>
<h2 class="stk-h2">Making a figure that reads well</h2>
<p class="stk-lead">A few conventions that make scientific figures clearer and more honest.</p>
<div style="margin-top:1.25rem; display:flex; flex-direction:column; gap:1rem; max-width:52rem;">
<div><h3 style="font-weight:700;margin-bottom:.3rem;">Label your axes with units</h3><p style="color:#64748b;line-height:1.6;">An axis without units is ambiguous. Write the quantity and its unit, e.g. <em>Time (s)</em> or <em>Concentration (mM)</em>. The X/Y label fields feed both the on-screen plot and the exported matplotlib code.</p></div>
<div><h3 style="font-weight:700;margin-bottom:.3rem;">Use log scales deliberately</h3><p style="color:#64748b;line-height:1.6;">A log axis linearises exponential or power-law data and shows several orders of magnitude at once, but it can flatter noisy data. Use it when the process is multiplicative, and say so in the caption.</p></div>
<div><h3 style="font-weight:700;margin-bottom:.3rem;">Colours that survive greyscale & colour-blindness</h3><p style="color:#64748b;line-height:1.6;">Around 8% of men have some colour-vision deficiency, and many journals print in greyscale. Prefer palettes that vary in lightness as well as hue, and distinguish traces by line style or markers too, not colour alone.</p></div>
<div><h3 style="font-weight:700;margin-bottom:.3rem;">Reproducibility</h3><p style="color:#64748b;line-height:1.6;">The <strong>Python</strong> export means a figure isn't a dead end: the generated matplotlib script regenerates the plot from the same CSV, so you can version-control it alongside your analysis. Everything runs in your browser, no data leaves your machine.</p></div>
</div>
</section>
<section class="stk-section" id="references" aria-label="References and documentation">
<span class="stk-chip"><i class="fa-solid fa-book"></i> References</span>
<h2 class="stk-h2">References & documentation</h2>
<ol class="stk-refs-list" style="margin-top:1rem;">
<li>Hunter, J. D. (2007). Matplotlib: A 2D graphics environment. <em>Computing in Science & Engineering</em>, 9(3), 90–95. <a href="https://matplotlib.org/stable/" target="_blank" rel="noopener">matplotlib.org</a>.</li>
<li>Rougier, N. P., Droettboom, M., & Bourne, P. E. (2014). Ten simple rules for better figures. <em>PLOS Computational Biology</em>, 10(9), e1003833.</li>
<li>Wong, B. (2011). Points of view: Color blindness. <em>Nature Methods</em>, 8(6), 441. <span style="opacity:.8">(colour-blind-safe palette guidance)</span></li>
<li>Software: <a href="https://plotly.com/javascript/" target="_blank" rel="noopener">Plotly.js</a> (interactive rendering) and <a href="https://www.papaparse.com/" target="_blank" rel="noopener">PapaParse</a> (CSV parsing). Exported code targets <a href="https://pandas.pydata.org/" target="_blank" rel="noopener">pandas</a> + matplotlib.</li>
</ol>
</section>
</div>
<footer class="mt-auto border-t border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-950 py-12">
<div class="max-w-7xl mx-auto px-6">
<div class="stk-dir mb-12">
<div>
<h4><i class="fa-solid fa-chart-pie text-indigo-500 text-xs"></i> Data & Stats</h4>
<ul>
<li><a href="plot-digitizer.html">Plot Digitizer</a></li>
<li><a href="data-cleaner.html">Data Cleaner</a></li>
<li><a href="stats-calculator.html">Stat Calculator</a></li>
<li><a href="error-bar-generator.html">Error Bar Gen</a></li>
<li><a href="outlier-detector.html">Outlier Detector</a></li>
<li><a href="curve-fitter.html">Curve Fitter</a></li>
<li><a href="plot-builder.html">Plot Builder</a></li>
<li><a href="xvg-visualizer.html">XVG Visualizer</a></li>
</ul>
</div>
<div>
<h4><i class="fa-solid fa-microchip text-orange-500 text-xs"></i> Compute</h4>
<ul>
<li><a href="structure-inspector.html">3D Inspector</a></li>
<li><a href="coordinate-manipulator.html">Coordinate Manipulator</a></li>
<li><a href="scientific-converter.html">Energy Conversions</a></li>
<li><a href="script-generator.html">HPC Script Gen</a></li>
</ul>
</div>
<div>
<h4><i class="fa-solid fa-book-open text-teal-500 text-xs"></i> Writing & Citations</h4>
<ul>
<li><a href="latex-formatter.html">Equation Formatter</a></li>
<li><a href="latex-tables.html">Visual LaTeX Tables</a></li>
<li><a href="doi-fetcher.html">DOI to BibTeX</a></li>
<li><a href="bibtex-deduplicator.html">BibTeX Deduplicator</a></li>
<li><a href="bibtex-sanitizer.html">BibTeX Sanitizer</a></li>
<li><a href="journal-abbreviator.html">Journal Abbrev</a></li>
</ul>
</div>
<div>
<h4><i class="fa-solid fa-headphones text-fuchsia-500 text-xs"></i> Focus & Flow</h4>
<ul>
<li><a href="pomodoro.html">Ambient Pomodoro</a></li>
<li><a href="decision.html">Decision Matrix</a></li>
<li><a href="sandbox.html">Kinetic Sandbox</a></li>
</ul>
</div>
</div>
<div class="border-t border-slate-200 dark:border-slate-800 pt-8 flex flex-col md:flex-row items-center justify-between text-slate-500 dark:text-slate-400 gap-4">
<div class="flex items-center gap-2">
<i class="fa-solid fa-flask text-xl text-slate-300 dark:text-slate-700"></i>
<span class="font-bold text-slate-700 dark:text-slate-300">STEMKit</span>
</div>
<div class="text-center text-sm font-medium">© 2026 STEMKit. Built by <a href="https://github.com/LD-Shell" target="_blank" rel="noopener" class="font-semibold hover:text-indigo-500 transition-colors">Olanrewaju M. Daramola</a>.</div>
<div class="flex gap-6 text-sm font-medium">
<a href="privacy.html#privacy" class="hover:text-indigo-500 transition-colors">Privacy Policy</a>
<a href="privacy.html#terms" class="hover:text-indigo-500 transition-colors">Terms of Service</a>
</div>
</div>
</div>
</footer>
</div>
<div id="toastContainer" class="fixed bottom-6 right-6 z-50 flex flex-col gap-3"></div>
<!-- Python code modal -->
<div id="codeModal" class="fixed inset-0 z-[60] hidden items-center justify-center p-4" style="background:rgba(15,23,42,.6);">
<div class="bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-2xl shadow-2xl w-full max-w-3xl max-h-[85vh] flex flex-col">
<div class="flex items-center justify-between p-4 border-b border-slate-200 dark:border-slate-700">
<h3 class="font-bold text-slate-800 dark:text-slate-100 flex items-center gap-2"><i class="fa-brands fa-python text-indigo-500"></i> matplotlib code</h3>
<div class="flex items-center gap-2">
<button id="copyCodeBtn" class="px-3 py-1.5 bg-indigo-600 hover:bg-indigo-700 text-white rounded-md text-xs font-bold transition-colors"><i class="fa-solid fa-copy mr-1"></i> Copy</button>
<button id="closeCodeBtn" class="w-8 h-8 rounded-md text-slate-400 hover:text-slate-700 dark:hover:text-slate-200 hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors"><i class="fa-solid fa-xmark"></i></button>
</div>
</div>
<div class="p-1 overflow-auto"><pre id="codeBlock" class="text-xs leading-relaxed p-4 font-mono text-slate-800 dark:text-slate-200 whitespace-pre overflow-x-auto"></pre></div>
<div class="px-4 py-2.5 border-t border-slate-200 dark:border-slate-700 text-[11px] text-slate-500 dark:text-slate-400">
Reproduces this figure with your data. Requires <code>pandas</code> and <code>matplotlib</code>. Point each <code>read_csv</code> at your file(s).
</div>
</div>
</div>
<script>
// 1. Theme toggle logic (Mobile & Desktop)
document.querySelectorAll('.themeToggle').forEach(btn => {
btn.addEventListener('click', () => {
document.documentElement.classList.toggle('dark');
localStorage.theme = document.documentElement.classList.contains('dark') ? 'dark' : 'light';
});
});
// 2. Mobile menu logic
const mobileMenuBtn = document.getElementById('mobile-menu-btn');
const mobileMenu = document.getElementById('mobile-menu');
const menuIcon = document.getElementById('menu-icon');
if(mobileMenuBtn) {
mobileMenuBtn.addEventListener('click', () => {
mobileMenu.classList.toggle('hidden');
if(mobileMenu.classList.contains('hidden')) {
menuIcon.classList.remove('fa-xmark');
menuIcon.classList.add('fa-bars');
} else {
menuIcon.classList.remove('fa-bars');
menuIcon.classList.add('fa-xmark');
}
});
document.querySelectorAll('.mobile-link').forEach(link => {
link.addEventListener('click', () => {
mobileMenu.classList.add('hidden');
menuIcon.classList.remove('fa-xmark');
menuIcon.classList.add('fa-bars');
});
});
}
</script>
<script src="js/plot-builder.js" defer></script>
</body>
</html>