Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Commit3aa65a3
committed
Revert datetime usetex ticklabels to use default tex font.
with `{\fontfamily{\familydefault}\selectfont ...}`, instead of usingmath and selectively escaping parts of the string.Note that this is only possible now that tex strings are passed "all atonce" to the tex process rather than "one line at a time", because ifbreaking at `"\n"` as previously done, then the braces of the texcommand above would become unbalanced (and lines other than the firstwould not see the `\selectfont`).The main difference in rendering is that hyphens (e.g. in YY-MM-DD) arenow rendered as plain hyphens rather than minus signs, but some googlingsuggests that this is in fact correct (see e.g. ctan datetime2 orisodate packages). Also, month names are now rendered with serif, butthat seems more consistent with day and years which are also serifed(and which were the original source of all these issues).See also the script below, which reproduces the various issues raisedover the years:```pythonfrom datetime import datetime, timedeltafrom matplotlib.dates import ConciseDateFormatter, DateFormatterimport matplotlib.pyplot as pltimport numpy as npplt.rcdefaults(); plt.rcParams['text.usetex'] = Truefig, axs = plt.subplots(4, constrained_layout=True, figsize=(12, 4))t0 = datetime.now()ts = [t0 + i * timedelta(days=1) for i in range(10)]axs[0].plot(ts, range(10))axs[1].plot(ts, range(10))axs[1].xaxis.set_major_formatter(ConciseDateFormatter(axs[1].xaxis.get_major_locator()))ts = [t0 + i * timedelta(seconds=6) for i in range(100)]axs[2].plot(ts, range(100))axs[3].xaxis.set_major_formatter(DateFormatter('%d/%m\n%Y'))plt.show()```1 parent2fe38b5 commit3aa65a3
2 files changed
+20
-32
lines changedLines changed: 1 addition & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
173 | 173 |
| |
174 | 174 |
| |
175 | 175 |
| |
176 |
| - | |
177 | 176 |
| |
178 | 177 |
| |
179 | 178 |
| |
| |||
605 | 604 |
| |
606 | 605 |
| |
607 | 606 |
| |
608 |
| - | |
609 |
| - | |
610 |
| - | |
611 |
| - | |
612 |
| - | |
613 |
| - | |
614 |
| - | |
615 |
| - | |
616 |
| - | |
617 |
| - | |
| 607 | + | |
618 | 608 |
| |
619 | 609 |
| |
620 | 610 |
| |
|
Lines changed: 19 additions & 21 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
322 | 322 |
| |
323 | 323 |
| |
324 | 324 |
| |
325 |
| - | |
| 325 | + | |
326 | 326 |
| |
327 |
| - | |
| 327 | + | |
328 | 328 |
| |
329 |
| - | |
| 329 | + | |
330 | 330 |
| |
331 |
| - | |
| 331 | + | |
332 | 332 |
| |
333 | 333 |
| |
334 | 334 |
| |
| |||
341 | 341 |
| |
342 | 342 |
| |
343 | 343 |
| |
344 |
| - | |
| 344 | + | |
| 345 | + | |
345 | 346 |
| |
346 | 347 |
| |
347 | 348 |
| |
| |||
636 | 637 |
| |
637 | 638 |
| |
638 | 639 |
| |
639 |
| - | |
| 640 | + | |
640 | 641 |
| |
641 |
| - | |
642 |
| - | |
643 |
| - | |
644 |
| - | |
| 642 | + | |
645 | 643 |
| |
646 |
| - | |
647 |
| - | |
648 |
| - | |
649 |
| - | |
650 |
| - | |
651 |
| - | |
| 644 | + | |
| 645 | + | |
652 | 646 |
| |
653 |
| - | |
654 |
| - | |
655 |
| - | |
656 |
| - | |
| 647 | + | |
657 | 648 |
| |
658 | 649 |
| |
659 | 650 |
| |
| |||
664 | 655 |
| |
665 | 656 |
| |
666 | 657 |
| |
667 |
| - | |
| 658 | + | |
| 659 | + | |
668 | 660 |
| |
669 | 661 |
| |
670 | 662 |
| |
| |||
1325 | 1317 |
| |
1326 | 1318 |
| |
1327 | 1319 |
| |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + |
0 commit comments
Comments
(0)