Matplotlib
pytao.plotting.mpl
Classes
pytao.plotting.mpl.MatplotlibGraphManager
MatplotlibGraphManager(tao)
Bases: GraphManager
Matplotlib backend graph manager.
Source code in pytao/plotting/plot.py
1223 1224 1225 1226 |
|
Functions
plot(template, *, region_name=None, include_layout=True, tight_layout=True, width=None, height=None, layout_height=None, figsize=None, share_x=True, xlim=None, ylim=None, save=None, settings=None, curves=None, axes=None)
Plot a graph with Matplotlib.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template
|
str
|
Graph template name. |
required |
region_name
|
str
|
Graph region name. |
None
|
include_layout
|
bool
|
Include a layout plot at the bottom, if not already placed and if appropriate (i.e., another plot uses longitudinal coordinates on the x-axis). |
True
|
tight_layout
|
bool
|
Apply a tight layout with matplotlib. |
True
|
figsize
|
(float, float)
|
Figure size. Alternative to specifying |
None
|
width
|
float
|
Width of the whole plot. |
None
|
height
|
float
|
Height of the whole plot. |
None
|
layout_height
|
float
|
Normalized height of the layout plot - assuming regular plots are
of height 1. Default is 0.5 which is configurable with |
None
|
share_x
|
bool
|
Share x-axes for all plots. |
True
|
xlim
|
(float, float)
|
X axis limits. |
None
|
ylim
|
(float, float)
|
Y axis limits. |
None
|
save
|
Path or str
|
Save the plot to the given filename. |
None
|
curves
|
Dict[int, TaoCurveSettings]
|
Dictionary of curve index to curve settings. These settings will be applied to the placed graph prior to plotting. |
None
|
settings
|
TaoGraphSettings
|
Graph customization settings. |
None
|
Returns:
Type | Description |
---|---|
list of graphs
|
List of plotted graphs. |
Figure
|
To gain access to the resulting plot objects, use the backend's
|
List[Axes]
|
|
Source code in pytao/plotting/mpl.py
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 |
|
plot_field(ele_id, *, colormap=None, radius=0.015, num_points=100, figsize=None, width=4, height=4, x_scale=1000.0, ax=None, save=None)
Plot field information for a given element.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ele_id
|
str
|
Element ID. |
required |
colormap
|
str
|
Colormap for the plot. Matplotlib defaults to "PRGn_r", and bokeh defaults to "". |
None
|
radius
|
float
|
Radius. |
0.015
|
num_points
|
int
|
Number of data points. |
100
|
ax
|
Axes
|
The axes to place the plot in. |
None
|
save
|
Path or str
|
Save the plot to the given filename. |
None
|
Source code in pytao/plotting/mpl.py
777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 |
|
plot_grid(templates, grid, *, include_layout=False, figsize=None, tight_layout=True, share_x='col', layout_height=None, width=None, height=None, xlim=None, ylim=None, curves=None, settings=None, save=None, axes=None)
Plot graphs on a grid with Matplotlib.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
templates
|
list of str
|
Graph template names. |
required |
grid
|
(nrows, ncols)
|
Grid the provided graphs into this many rows and columns. |
required |
include_layout
|
bool
|
Include a layout plot at the bottom of each column. |
False
|
tight_layout
|
bool
|
Apply a tight layout with matplotlib. |
True
|
figsize
|
(float, float)
|
Figure size. Alternative to specifying |
None
|
width
|
float
|
Width of the whole plot. |
None
|
height
|
float
|
Height of the whole plot. |
None
|
layout_height
|
int
|
Normalized height of the layout plot - assuming regular plots are
of height 1. Default is 0.5 which is configurable with |
None
|
share_x
|
(bool, 'row', 'col', 'all')
|
Share all x-axes ( |
"col"
|
xlim
|
list of (float, float)
|
X axis limits for each graph. |
None
|
ylim
|
list of (float, float)
|
Y axis limits for each graph. |
None
|
curves
|
list of Dict[int, TaoCurveSettings]
|
One dictionary per graph, with each dictionary mapping the curve index to curve settings. These settings will be applied to the placed graphs prior to plotting. |
None
|
settings
|
list of TaoGraphSettings
|
Graph customization settings, per graph. |
None
|
save
|
Path or str
|
Save the plot to the given filename. |
None
|
Returns:
Type | Description |
---|---|
list of graphs
|
List of plotted graphs. |
Figure
|
To gain access to the resulting plot objects, use the backend's
|
List[List[Axes]]
|
Gridded axes, accessible with |
Source code in pytao/plotting/mpl.py
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 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 |
|
Functions
pytao.plotting.mpl.set_defaults
set_defaults(layout_height=None, colormap=None, line_width_scale=None, floor_line_width_scale=None, figsize=None, width=None, height=None, dpi=None)
Set default values for Matplotlib plot settings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layout_height
|
float
|
Height of the layout. Default is 0.5. |
None
|
colormap
|
str
|
Colormap to use for plotting. Default is "PRGn_r". |
None
|
line_width_scale
|
float
|
Scale factor for line widths, excluding floor plan lines. Default is 0.5. |
None
|
floor_line_width_scale
|
float
|
Scale factor for floor plan line widths. Default is 0.5. |
None
|
figsize
|
tuple of float
|
Size of the figure (width, height). Default is as-configured in matplotlib rcParams. |
None
|
width
|
float
|
Width of the figure in inches. Default is as-configured in matplotlib rcParams. |
None
|
height
|
float
|
Height of the figure in inches. Default is as-configured in matplotlib rcParams. |
None
|
dpi
|
int
|
Dots per inch for the figure. Default is as-configured in matplotlib rcParams. |
None
|
Source code in pytao/plotting/mpl.py
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 |
|
pytao.plotting.mpl.setup_matplotlib_axis
setup_matplotlib_axis(graph, ax)
Configure limits, title, and basic info for the given axes.
Source code in pytao/plotting/mpl.py
162 163 164 165 166 167 168 169 170 171 172 173 |
|