Commit 28fccc3
fix: legend, style persistence, and axis ranges in combined figures (#53)
* fix: legend visibility, style persistence, and axis ranges in combined figures
Combined figures (overlay, add_secondary_y) had three issues:
1. Legends disappeared because Plotly Express sets showlegend=False on
single-trace figures. Now unnamed traces get names derived from the
source figure's y-axis title, and showlegend is fixed per legendgroup.
2. Colors and styles were lost during animation because frame traces
carried PX defaults. Now marker, line, opacity and legend properties
are propagated from fig.data into all animation frame traces.
3. Axis ranges were computed from fig.data only, so frames with different
data ranges went off-screen during animation. Now global min/max is
computed across all frames and set explicitly on the layout.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add subplots() for composing figures into a grid
New function to arrange independent figures in a subplot grid:
grid = subplots(fig1, fig2, fig3, cols=2)
- Subplot titles auto-derived from figure title or y-axis label
- Axis config (titles, tick format, type) copied from source figures
- Validates: rejects faceted or animated figures (not supported)
- Empty cells via go.Figure()
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: add subplots examples to combining notebook
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: support faceted figures in subplots()
Rewrote subplots() to use manual axis domain management instead of
make_subplots. Each figure's internal axes are remapped with scaled
domains to fit within the grid cell, so faceted figures now work.
Updated notebook with faceted subplots example.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: review findings — datetime axis, bar baseline, type narrowing, stale bullet
- Skip datetime64/timedelta64 axes in _fix_animation_axis_ranges to
prevent float epoch corruption; leave them on autorange
- Include zero in axis range for bar traces so bars grow from baseline
- Use isinstance(str) check in _get_figure_title for mypy type narrowing
- Remove stale slider_to_dropdown bullet from notebook intro
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: disambiguation condition and stale comment
- Only disambiguate labels when all are non-empty and identical,
preventing spurious suffixes when mixing named and unnamed figures
- Update stale make_subplots comment in test
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: unused variable lint error in test
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent fbca665 commit 28fccc3
File tree
4 files changed
+926
-37
lines changed- docs/examples
- tests
- xarray_plotly
4 files changed
+926
-37
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
440 | 441 | | |
441 | 442 | | |
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 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
443 | 566 | | |
444 | 567 | | |
445 | 568 | | |
| |||
450 | 573 | | |
451 | 574 | | |
452 | 575 | | |
453 | | - | |
| 576 | + | |
454 | 577 | | |
455 | 578 | | |
456 | 579 | | |
| |||
461 | 584 | | |
462 | 585 | | |
463 | 586 | | |
464 | | - | |
| 587 | + | |
465 | 588 | | |
466 | 589 | | |
467 | 590 | | |
| |||
479 | 602 | | |
480 | 603 | | |
481 | 604 | | |
482 | | - | |
| 605 | + | |
483 | 606 | | |
484 | 607 | | |
485 | 608 | | |
| |||
490 | 613 | | |
491 | 614 | | |
492 | 615 | | |
493 | | - | |
| 616 | + | |
494 | 617 | | |
495 | 618 | | |
496 | 619 | | |
| |||
508 | 631 | | |
509 | 632 | | |
510 | 633 | | |
511 | | - | |
| 634 | + | |
512 | 635 | | |
513 | 636 | | |
514 | 637 | | |
| |||
519 | 642 | | |
520 | 643 | | |
521 | 644 | | |
522 | | - | |
| 645 | + | |
523 | 646 | | |
524 | 647 | | |
525 | 648 | | |
| |||
535 | 658 | | |
536 | 659 | | |
537 | 660 | | |
538 | | - | |
| 661 | + | |
539 | 662 | | |
540 | 663 | | |
541 | 664 | | |
| |||
546 | 669 | | |
547 | 670 | | |
548 | 671 | | |
549 | | - | |
| 672 | + | |
550 | 673 | | |
551 | 674 | | |
552 | 675 | | |
| |||
564 | 687 | | |
565 | 688 | | |
566 | 689 | | |
567 | | - | |
| 690 | + | |
568 | 691 | | |
569 | 692 | | |
570 | 693 | | |
| |||
575 | 698 | | |
576 | 699 | | |
577 | 700 | | |
578 | | - | |
| 701 | + | |
579 | 702 | | |
580 | 703 | | |
581 | 704 | | |
| |||
593 | 716 | | |
594 | 717 | | |
595 | 718 | | |
596 | | - | |
| 719 | + | |
597 | 720 | | |
598 | 721 | | |
599 | 722 | | |
| |||
602 | 725 | | |
603 | 726 | | |
604 | 727 | | |
605 | | - | |
| 728 | + | |
606 | 729 | | |
607 | 730 | | |
608 | 731 | | |
| |||
618 | 741 | | |
619 | 742 | | |
620 | 743 | | |
621 | | - | |
| 744 | + | |
622 | 745 | | |
623 | 746 | | |
624 | 747 | | |
625 | 748 | | |
626 | 749 | | |
627 | 750 | | |
628 | 751 | | |
629 | | - | |
| 752 | + | |
| 753 | + | |
630 | 754 | | |
631 | 755 | | |
632 | 756 | | |
| |||
0 commit comments