4

Happy holidays everyone!

A little question: I want to transform the second to minute in x-axis. Is there any solution such as add some math expressions can do it?

Here is my code:

\documentclass{standalone}

\usepackage{pgfplots}
\pgfplotsset{compat=1.17}

\begin{document}

\pgfplotstableread{%You can skip these data directly.
x y
1   1543.36
2   1543.35
3   1543.33
4   1543.34
5   1543.34
6   1543.35
7   1543.35
8   1543.36
9   1543.36
10  1543.35
11  1543.35
14  1551.02
15  1551.13
16  1551.15
17  1551.3
18  1551.57
19  1551.86
20  1552.14
21  1552.46
22  1552.73
23  1552.98
24  1553.2
25  1553.42
26  1553.59
27  1553.75
28  1553.88
29  1554
30  1554.12
31  1554.23
32  1554.32
33  1554.45
34  1554.57
35  1554.66
36  1554.75
37  1554.82
38  1554.9
39  1554.99
40  1555.06
41  1555.13
42  1555.2
43  1555.24
44  1555.31
45  1555.37
46  1555.39
47  1555.44
48  1555.49
49  1555.55
50  1555.6
51  1555.66
52  1555.71
53  1555.76
54  1555.79
55  1555.84
56  1555.88
57  1555.89
58  1555.92
59  1555.96
60  1556.01
61  1556.08
62  1556.14
63  1556.15
64  1556.21
65  1556.23
66  1556.26
67  1556.26
68  1556.28
69  1556.33
70  1556.35
71  1556.37
72  1556.36
73  1556.42
74  1556.44
75  1556.51
76  1556.49
77  1556.54
78  1556.58
79  1556.63
80  1556.67
81  1556.68
82  1556.71
83  1556.75
84  1556.81
85  1556.87
86  1556.89
87  1556.91
88  1556.92
89  1556.97
90  1556.97
91  1557
92  1557.03
93  1557.1
94  1557.12
95  1557.15
96  1557.14
97  1557.2
98  1557.22
99  1557.3
100 1557.34
101 1557.33
102 1557.35
103 1557.36
104 1557.45
105 1557.48
106 1557.52
107 1557.5
108 1557.54
109 1557.65
110 1557.63
111 1557.69
112 1557.7
113 1557.7
114 1557.73
115 1557.69
116 1557.71
117 1557.73
118 1557.8
119 1557.82
120 1557.88
121 1557.88
122 1557.91
123 1557.94
124 1557.92
125 1557.97
126 1558.03
127 1558.07
128 1558.13
129 1558.15
130 1558.18
131 1558.18
132 1558.29
133 1558.26
134 1558.34
135 1558.35
136 1558.39
137 1558.39
138 1558.45
139 1558.43
140 1558.39
141 1558.42
142 1558.45
143 1558.44
144 1558.48
145 1558.5
146 1558.55
147 1558.58
148 1558.59
151 1546.07
152 1546.02
153 1545.99
154 1545.96
155 1545.95
156 1545.93
157 1545.91
158 1545.91
159 1545.9
160 1545.88
161 1545.87
164 1537.18
165 1537.36
166 1537.49
167 1537.59
168 1537.68
169 1537.75
170 1537.82
171 1537.87
172 1537.93
173 1538.01
174 1538.09
175 1538.16
176 1538.23
177 1538.29
178 1538.33
179 1538.37
180 1538.41
181 1538.45
182 1538.5
183 1538.55
184 1538.6
185 1538.65
186 1538.69
187 1538.72
188 1538.78
189 1538.81
190 1538.87
191 1538.9
192 1538.94
193 1538.95
194 1539
195 1539.02
196 1539.05
197 1539.09
198 1539.12
199 1539.14
200 1539.17
201 1539.19
202 1539.21
203 1539.24
204 1539.27
205 1539.29
206 1539.31
207 1539.33
208 1539.35
209 1539.37
210 1539.39
211 1539.41
212 1539.43
213 1539.45
214 1539.46
215 1539.49
216 1539.51
217 1539.52
218 1539.54
219 1539.55
220 1539.56
221 1539.59
222 1539.6
223 1539.62
224 1539.64
225 1539.65
226 1539.66
227 1539.68
228 1539.69
229 1539.7
232 1531.15
233 1531.11
234 1531.1
235 1531.08
236 1531.08
237 1531.08
238 1531.08
239 1531.09
240 1531.09
241 1531.1
242 1531.1
243 1531.1
244 1531.11
247 1533.58
248 1533.5
249 1533.46
250 1533.44
251 1533.42
252 1533.41
253 1533.4
254 1533.39
255 1533.39
256 1533.4
257 1533.39
258 1533.4
259 1533.39
260 1533.38
261 1533.39
262 1533.4
263 1533.4
264 1533.41
265 1533.41
266 1533.41
267 1533.42
268 1533.41
269 1533.41
270 1533.4
271 1533.4
272 1533.4
273 1533.4
274 1533.39
275 1533.4
276 1533.39
277 1533.39
278 1533.38
279 1533.39
280 1533.39
281 1533.38
282 1533.39
283 1533.39
284 1533.38
285 1533.38
286 1533.37
287 1533.38
288 1533.37
289 1533.38
290 1533.37
291 1533.37
292 1533.37
293 1533.37
294 1533.38
295 1533.37
296 1533.37
297 1533.37
298 1533.38
299 1533.37
300 1533.37
301 1533.37
302 1533.37
303 1533.37
304 1533.37
305 1533.37
306 1533.37
307 1533.37
308 1533.37
309 1533.37
310 1533.37
311 1533.38
312 1533.37
313 1533.37
314 1533.38
315 1533.38
316 1533.39
317 1533.38
318 1533.39
319 1533.39
320 1533.4
321 1533.41
322 1533.4
323 1533.39
324 1533.4
325 1533.4
326 1533.4
327 1533.4
328 1533.4
329 1533.4
330 1533.41
331 1533.42
332 1533.41
333 1533.42
334 1533.42
335 1533.43
336 1533.42
337 1533.42
338 1533.42
339 1533.42
340 1533.43
341 1533.42
342 1533.42
343 1533.43
344 1533.44
345 1533.44
346 1533.43
347 1533.44
348 1533.43
349 1533.44
350 1533.45
351 1533.45
352 1533.45
353 1533.44
354 1533.44
355 1533.45
356 1533.45
357 1533.45
358 1533.46
359 1533.46
360 1533.46
361 1533.47
362 1533.47
363 1533.47
364 1533.47
365 1533.45
366 1533.45
367 1533.45
368 1533.45
369 1533.45
370 1533.45
371 1533.46
372 1533.46
373 1533.46
374 1533.47
375 1533.47
376 1533.46
377 1533.46
378 1533.46
379 1533.45
380 1533.46
381 1533.45
382 1533.45
383 1533.45
384 1533.45
385 1533.45
386 1533.45
387 1533.46
390 1531.43
391 1531.4
392 1531.39
393 1531.38
394 1531.36
395 1531.35
396 1531.34
397 1531.32
398 1531.32
399 1531.31
402 1534.62
403 1534.65
404 1534.73
405 1534.81
406 1534.9
407 1534.94
408 1534.99
409 1535.05
410 1535.1
411 1535.14
412 1535.18
413 1535.22
414 1535.27
415 1535.29
416 1535.34
417 1535.38
418 1535.41
419 1535.43
420 1535.47
421 1535.49
422 1535.52
423 1535.54
424 1535.57
425 1535.6
426 1535.61
427 1535.63
428 1535.64
429 1535.67
430 1535.7
431 1535.71
432 1535.73
433 1535.74
434 1535.75
435 1535.77
436 1535.78
437 1535.79
438 1535.81
439 1535.82
440 1535.82
441 1535.83
442 1535.85
443 1535.87
444 1535.86
445 1535.87
446 1535.88
447 1535.9
448 1535.91
449 1535.91
450 1535.92
451 1535.92
452 1535.94
453 1535.95
454 1535.94
455 1535.96
456 1535.96
457 1535.96
458 1535.98
459 1535.98
460 1535.99
461 1536
462 1535.99
463 1535.99
464 1536.01
465 1536.01
466 1536.01
467 1536.01
468 1536.01
469 1536.02
470 1536.02
471 1536.02
472 1536.03
473 1536.02
474 1536.04
475 1536.04
476 1536.04
477 1536.04
478 1536.04
479 1536.04
480 1536.04
481 1536.04
482 1536.06
483 1536.06
484 1536.05
485 1536.06
486 1536.06
487 1536.07
488 1536.06
489 1536.08
490 1536.07
491 1536.08
492 1536.08
493 1536.09
494 1536.09
495 1536.1
496 1536.08
497 1536.09
498 1536.09
499 1536.09
500 1536.09
501 1536.1
502 1536.1
503 1536.1
504 1536.1
505 1536.11
506 1536.1
507 1536.11
508 1536.1
509 1536.11
510 1536.12
511 1536.11
512 1536.11
513 1536.12
514 1536.12
515 1536.11
516 1536.13
517 1536.13
518 1536.13
519 1536.12
520 1536.13
521 1536.12
522 1536.14
523 1536.15
524 1536.14
525 1536.16
526 1536.16
527 1536.16
528 1536.17
529 1536.17
530 1536.16
531 1536.17
532 1536.17
533 1536.17
534 1536.17
535 1536.18
536 1536.17
537 1536.18
538 1536.18
539 1536.19
540 1536.17
541 1536.18
542 1536.19
545 1533.46
546 1533.44
547 1533.41
548 1533.38
549 1533.37
550 1533.37
551 1533.34
552 1533.34
553 1533.32
554 1533.3
555 1533.3
}{\datatable}

\begin{tikzpicture}
\begin{axis}[
xlabel={Time (*24s)},
ylabel={Wavelength(nm)},
]

\addplot+ [] table []{\datatable};

\end{axis}
\end{tikzpicture}
\end{document}

And here is what I've got:

enter image description here

4

I think what you are looking for is x filter/.code={\pgfmathparse{#1/60}\pgfmathresult}

\begin{tikzpicture}
\begin{axis}[
    x filter/.code={\pgfmathparse{#1/60}\pgfmathresult},
    xlabel={Time (*24s)},
    ylabel={Wavelength nm},
]

\addplot+ [] table []{\datatable};

\end{axis}
\end{tikzpicture}

which yields:

enter image description here

1
  • It's exactly what I wanted! Thanks! – go go Dec 25 '20 at 3:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.