vedo.pyplot

figure
Figure
Bases: Assembly
Format class for figures.
Source code in vedo/pyplot/figure.py
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 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 | |
add_label(text, c=None, marker='', mc='black')
Manually add en entry label to the legend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
text string for the label. |
required |
c
|
str
|
color of the text |
None
|
marker
|
(str), Mesh a marker char or a Mesh object to be used as marker |
required | |
mc
|
str
|
color for the marker |
'black'
|
Source code in vedo/pyplot/figure.py
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | |
add_legend(pos='top-right', relative=True, font=None, s=1, c=None, vspace=1.75, padding=0.1, radius=0, alpha=0.8, bc='k7', lw=1, lc='k4', z=0)
Add existing labels to form a legend box.
Labels have been previously filled with eg: plot(..., label="text")
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pos
|
(str, list)
|
A string or 2D coordinates. The default is "top-right". |
'top-right'
|
relative
|
bool
|
control whether |
True
|
font
|
(str, int)
|
font name or number. Check available fonts here. |
None
|
s
|
float
|
global size of the legend |
1
|
c
|
str
|
color of the text |
None
|
vspace
|
float
|
vertical spacing of lines |
1.75
|
padding
|
float
|
padding of the box as a fraction of the text size |
0.1
|
radius
|
float
|
border radius of the box |
0
|
alpha
|
float
|
opacity of the box. Values below 1 may cause poor rendering because of antialiasing. Use alpha = 0 to remove the box. |
0.8
|
bc
|
str
|
box color |
'k7'
|
lw
|
int
|
border line width of the box in pixel units |
1
|
lc
|
int
|
border line color of the box |
'k4'
|
z
|
float
|
set the zorder as z position (useful to avoid overlap) |
0
|
Source code in vedo/pyplot/figure.py
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 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 | |
insert(*objs, rescale=True, as3d=True, adjusted=False, cut=True)
Insert objects into a Figure.
The recommended syntax is to use "+=", which calls insert() under the hood.
If a whole Figure is added with "+=", it is unpacked and its objects are added
one by one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rescale
|
bool
|
rescale the y axis position while inserting the object. |
True
|
as3d
|
bool
|
if True keep the aspect ratio of the 3d object, otherwise stretch it in y. |
True
|
adjusted
|
bool
|
adjust the scaling according to the shortest axis |
False
|
cut
|
bool
|
cut off the parts of the object which go beyond the axes frame. |
True
|
Source code in vedo/pyplot/figure.py
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 | |
LabelData
Helper internal class to hold label information.
Source code in vedo/pyplot/figure.py
26 27 28 29 30 31 32 33 34 | |
charts
Histogram1D
Bases: Figure
1D histogramming.
Source code in vedo/pyplot/charts.py
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 | |
print(**kwargs)
Print infos about this histogram
Source code in vedo/pyplot/charts.py
405 406 407 408 409 410 411 412 413 414 415 | |
Histogram2D
Bases: Figure
2D histogramming.
Source code in vedo/pyplot/charts.py
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 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 | |
PlotBars
Bases: Figure
Creates a PlotBars(Figure) object.
Source code in vedo/pyplot/charts.py
622 623 624 625 626 627 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 776 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 | |
PlotXY
Bases: Figure
Creates a PlotXY(Figure) object.
Source code in vedo/pyplot/charts.py
845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 | |
functions
fit(points, deg=1, niter=0, nstd=3, xerrors=None, yerrors=None, vrange=None, res=250, lw=3, c='red4')
Polynomial fitting with parameter error and error bands calculation. Errors bars in both x and y are supported.
Returns a vedo.shapes.Line object.
Additional information about the fitting output can be accessed with:
fitd = fit(pts)
fitd.coefficientswill contain the coefficients of the polynomial fitfitd.coefficient_errors, errors on the fitting coefficientsfitd.monte_carlo_coefficients, fitting coefficient set from MC generationfitd.covariance_matrix, covariance matrix as a numpy arrayfitd.reduced_chi2, reduced chi-square of the fittingfitd.ndof, number of degrees of freedomfitd.data_sigma, mean data dispersion from the central fit assumingChi2=1fitd.error_lines, avedo.shapes.Lineobject for the upper and lower error bandfitd.error_band, thevedo.mesh.Meshobject representing the error band
Errors on x and y can be specified. If left to None an estimate is made from
the statistical spread of the dataset itself. Errors are always assumed gaussian.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
deg
|
int
|
degree of the polynomial to be fitted |
1
|
niter
|
int
|
number of monte-carlo iterations to compute error bands. If set to 0, return the simple least-squares fit with naive error estimation on coefficients only. A reasonable non-zero value to set is about 500, in this case error_lines, error_band and the other class attributes are filled |
0
|
nstd
|
float
|
nr. of standard deviation to use for error calculation |
3
|
xerrors
|
list
|
array of the same length of points with the errors on x |
None
|
yerrors
|
list
|
array of the same length of points with the errors on y |
None
|
vrange
|
list
|
specify the domain range of the fitting line (only affects visualization, but can be used to extrapolate the fit outside the data range) |
None
|
res
|
int
|
resolution of the output fitted line and error lines |
250
|
Examples:

Source code in vedo/pyplot/functions.py
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 776 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 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 | |
histogram(*args, **kwargs)
Histogramming for 1D and 2D data arrays.
This is meant as a convenience function that creates the appropriate object based on the shape of the provided input data.
Use keyword like=... if you want to use the same format of a previously
created Figure (useful when superimposing Figures) to make sure
they are compatible and comparable. If they are not compatible
you will receive an error message.
.. note:: default mode, for 1D arrays
Creates a Histogram1D(Figure) object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
weights
|
list
|
An array of weights, of the same shape as |
required |
bins
|
int
|
number of bins |
required |
vrange
|
list
|
restrict the range of the histogram |
required |
density
|
bool
|
normalize the area to 1 by dividing by the nr of entries and bin size |
required |
logscale
|
bool
|
use logscale on y-axis |
required |
fill
|
bool
|
fill bars with solid color |
required |
gap
|
float
|
leave a small space btw bars |
required |
radius
|
float
|
border radius of the top of the histogram bar. Default value is 0.1. |
required |
texture
|
str
|
url or path to an image to be used as texture for the bin |
required |
outline
|
bool
|
show outline of the bins |
required |
errors
|
bool
|
show error bars |
required |
xtitle
|
str
|
title for the x-axis, can also be set using |
required |
ytitle
|
str
|
title for the y-axis, can also be set using |
required |
padding
|
(float, list)
|
keep a padding space from the axes (as a fraction of the axis size). This can be a list of four numbers. |
required |
aspect
|
float
|
the desired aspect ratio of the histogram. Default is 4/3. |
required |
grid
|
bool
|
show the background grid for the axes, can also be set using |
required |
ztolerance
|
float
|
a tolerance factor to superimpose objects (along the z-axis). |
required |
Examples:

.. note:: default mode, for 2D arrays
Input data formats [(x1,x2,..), (y1,y2,..)] or [(x1,y1), (x2,y2),..]
are both valid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bins
|
list
|
binning as (nx, ny) |
required |
weights
|
list
|
array of weights to assign to each entry |
required |
cmap
|
(str, lookuptable)
|
color map name or look up table |
required |
alpha
|
float
|
opacity of the histogram |
required |
gap
|
float
|
separation between adjacent bins as a fraction for their size. Set gap=-1 to generate a quad surface. |
required |
scalarbar
|
bool
|
add a scalarbar to right of the histogram |
required |
like
|
Figure
|
grab and use the same format of the given Figure (for superimposing) |
required |
xlim
|
list
|
[x0, x1] range of interest. If left to None will automatically choose the minimum or the maximum of the data range. Data outside the range are completely ignored. |
required |
ylim
|
list
|
[y0, y1] range of interest. If left to None will automatically choose the minimum or the maximum of the data range. Data outside the range are completely ignored. |
required |
aspect
|
float
|
the desired aspect ratio of the figure. |
required |
title
|
str
|
title of the plot to appear on top. If left blank some statistics will be shown. |
required |
xtitle
|
str
|
x axis title |
required |
ytitle
|
str
|
y axis title |
required |
ztitle
|
str
|
title for the scalar bar |
required |
ac
|
str
|
axes color, additional keyword for Axes can also be added
using e.g. |
required |
Examples:

.. note:: mode="3d"
If mode='3d', build a 2D histogram as 3D bars from a list of x and y values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xtitle
|
str
|
x axis title |
required |
bins
|
int
|
nr of bins for the smaller range in x or y |
required |
vrange
|
list
|
range in x and y in format |
required |
norm
|
float
|
sets a scaling factor for the z axis (frequency axis) |
required |
fill
|
bool
|
draw solid hexagons |
required |
cmap
|
str
|
color map name for elevation |
required |
gap
|
float
|
keep a internal empty gap between bins [0,1] |
required |
zscale
|
float
|
rescale the (already normalized) zaxis for visual convenience |
required |
Examples:
.. note:: mode="hexbin"
If mode='hexbin', build a hexagonal histogram from a list of x and y values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xtitle
|
str
|
x axis title |
required |
bins
|
int
|
nr of bins for the smaller range in x or y |
required |
vrange
|
list
|
range in x and y in format |
required |
norm
|
float
|
sets a scaling factor for the z axis (frequency axis) |
required |
fill
|
bool
|
draw solid hexagons |
required |
cmap
|
str
|
color map name for elevation |
required |
Examples:

.. note:: mode="polar"
If mode='polar' assume input is polar coordinate system (rho, theta):
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
weights
|
list
|
Array of weights, of the same shape as the input. Each value only contributes its associated weight towards the bin count (instead of 1). |
required |
title
|
str
|
histogram title |
required |
tsize
|
float
|
title size |
required |
bins
|
int
|
number of bins in phi |
required |
r1
|
float
|
inner radius |
required |
r2
|
float
|
outer radius |
required |
phigap
|
float
|
gap angle btw 2 radial bars, in degrees |
required |
rgap
|
float
|
gap factor along radius of numeric angle labels |
required |
lpos
|
float
|
label gap factor along radius |
required |
lsize
|
float
|
label size |
required |
c
|
color
|
color of the histogram bars, can be a list of length |
required |
bc
|
color
|
color of the frame and labels |
required |
alpha
|
float
|
opacity of the frame |
required |
cmap
|
str
|
color map name |
required |
deg
|
bool
|
input array is in degrees |
required |
vmin
|
float
|
minimum value of the radial axis |
required |
vmax
|
float
|
maximum value of the radial axis |
required |
labels
|
list
|
list of labels, must be of length |
required |
show_disc
|
bool
|
show the outer ring axis |
required |
nrays
|
int
|
draw this number of axis rays (continuous and dashed) |
required |
show_lines
|
bool
|
show lines to the origin |
required |
show_angles
|
bool
|
show angular values |
required |
show_errors
|
bool
|
show error bars |
required |
Examples:

.. note:: mode="spheric"
If mode='spheric', build a histogram from list of theta and phi values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rmax
|
float
|
maximum radial elevation of bin |
required |
res
|
int
|
sphere resolution |
required |
cmap
|
str
|
color map name |
required |
lw
|
int
|
line width of the bin edges |
required |
Examples:

Source code in vedo/pyplot/functions.py
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 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 627 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 | |
plot(*args, **kwargs)
Draw a 2D line plot, or scatter plot, of variable x vs variable y.
Input format can be either [allx], [allx, ally] or [(x1,y1), (x2,y2), ...]
Use like=... if you want to use the same format of a previously
created Figure (useful when superimposing Figures) to make sure
they are compatible and comparable. If they are not compatible
you will receive an error message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xerrors
|
bool
|
show error bars associated to each point in x |
required |
yerrors
|
bool
|
show error bars associated to each point in y |
required |
lw
|
int
|
width of the line connecting points in pixel units. Set it to 0 to remove the line. |
required |
lc
|
str
|
line color |
required |
la
|
float
|
line "alpha", opacity of the line |
required |
dashed
|
bool
|
draw a dashed line instead of a continuous line |
required |
splined
|
bool
|
spline the line joining the point as a countinous curve |
required |
elw
|
int
|
width of error bar lines in units of pixels |
required |
ec
|
color
|
color of error bar, by default the same as marker color |
required |
error_band
|
bool
|
represent errors on y as a filled error band.
Use |
required |
marker
|
(str, int)
|
use a marker for the data points |
required |
ms
|
float
|
marker size |
required |
mc
|
color
|
color of the marker |
required |
ma
|
float
|
opacity of the marker |
required |
xlim
|
list
|
set limits to the range for the x variable |
required |
ylim
|
list
|
set limits to the range for the y variable |
required |
aspect
|
float
|
Desired aspect ratio. If None, it is automatically calculated to get a reasonable aspect ratio. Scaling factor is saved in Figure.yscale |
required |
padding
|
(float, list)
|
keep a padding space from the axes (as a fraction of the axis size). This can be a list of four numbers. |
required |
title
|
str
|
title to appear on the top of the frame, like a header. |
required |
xtitle
|
str
|
title for the x-axis, can also be set using |
required |
ytitle
|
str
|
title for the y-axis, can also be set using |
required |
ac
|
str
|
axes color |
required |
grid
|
bool
|
show the background grid for the axes, can also be set using |
required |
ztolerance
|
float
|
a tolerance factor to superimpose objects (along the z-axis). |
required |
Examples:
import numpy as np
from vedo.pyplot import plot
from vedo import settings
settings.remember_last_figure_format = True #############
x = np.linspace(0, 6.28, num=50)
fig = plot(np.sin(x), 'r-')
fig+= plot(np.cos(x), 'bo-') # no need to specify like=...
fig.show().close()
Examples:
.. note:: mode="bar"
Creates a PlotBars(Figure) object.
Input must be in format [counts, labels, colors, edges].
Either or both edges and colors are optional and can be omitted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
errors
|
bool
|
show error bars |
required |
logscale
|
bool
|
use logscale on y-axis |
required |
fill
|
bool
|
fill bars with solid color |
required |
gap
|
float
|
leave a small space btw bars |
required |
radius
|
float
|
border radius of the top of the histogram bar. Default value is 0.1. |
required |
texture
|
str
|
url or path to an image to be used as texture for the bin |
required |
outline
|
bool
|
show outline of the bins |
required |
xtitle
|
str
|
title for the x-axis, can also be set using |
required |
ytitle
|
str
|
title for the y-axis, can also be set using |
required |
ac
|
str
|
axes color |
required |
padding
|
(float, list)
|
keep a padding space from the axes (as a fraction of the axis size). This can be a list of four numbers. |
required |
aspect
|
float
|
the desired aspect ratio of the figure. Default is 4/3. |
required |
grid
|
bool
|
show the background grid for the axes, can also be set using |
required |
Examples:

.. note:: 2D functions
If input is an external function or a formula, draw the surface
representing the function f(x,y).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
x range of values |
required |
y
|
float
|
y range of values |
required |
zlimits
|
float
|
limit the z range of the independent variable |
required |
zlevels
|
int
|
will draw the specified number of z-levels contour lines |
required |
show_nan
|
bool
|
show where the function does not exist as red points |
required |
bins
|
list
|
number of bins in x and y |
required |
Examples:
.. note:: mode="complex"
If mode='complex' draw the real value of the function and color map the imaginary part.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cmap
|
str
|
diverging color map (white means |
required |
lw
|
float
|
line with of the binning |
required |
bins
|
list
|
binning in x and y |
required |
Examples:
.. note:: mode="polar"
If mode='polar' input arrays are interpreted as a list of polar angles and radii.
Build a polar (radar) plot by joining the set of points in polar coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
plot title |
required |
tsize
|
float
|
title size |
required |
bins
|
int
|
number of bins in phi |
required |
r1
|
float
|
inner radius |
required |
r2
|
float
|
outer radius |
required |
lsize
|
float
|
label size |
required |
c
|
color
|
color of the line |
required |
ac
|
color
|
color of the frame and labels |
required |
alpha
|
float
|
opacity of the frame |
required |
ps
|
int
|
point size in pixels, if ps=0 no point is drawn |
required |
lw
|
int
|
line width in pixels, if lw=0 no line is drawn |
required |
deg
|
bool
|
input array is in degrees |
required |
vmax
|
float
|
normalize radius to this maximum value |
required |
fill
|
bool
|
fill convex area with solid color |
required |
splined
|
bool
|
interpolate the set of input points |
required |
show_disc
|
bool
|
draw the outer ring axis |
required |
nrays
|
int
|
draw this number of axis rays (continuous and dashed) |
required |
show_lines
|
bool
|
draw lines to the origin |
required |
show_angles
|
bool
|
draw angle values |
required |
Examples:
.. note:: mode="spheric"
If mode='spheric' input must be an external function rho(theta, phi).
A surface is created in spherical coordinates.
Return an Figure(Assembly) of 2 objects: the unit
sphere (in wireframe representation) and the surface rho(theta, phi).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rfunc
|
function
handle to a user defined function |
required | |
normalize
|
bool
|
scale surface to fit inside the unit sphere |
required |
res
|
int
|
grid resolution of the unit sphere |
required |
scalarbar
|
bool
|
add a 3D scalarbar to the plot for radius |
required |
c
|
color
|
color of the unit sphere |
required |
alpha
|
float
|
opacity of the unit sphere |
required |
cmap
|
str
|
color map for the surface |
required |
Examples:
Source code in vedo/pyplot/functions.py
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 | |
streamplot(X, Y, U, V, direction='both', max_propagation=None, lw=2, cmap='viridis', probes=())
Generate a streamline plot of a vectorial field (U,V) defined at positions (X,Y).
Returns a Mesh object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
direction
|
str
|
either "forward", "backward" or "both" |
'both'
|
max_propagation
|
float
|
maximum physical length of the streamline |
None
|
lw
|
float
|
line width in absolute units |
2
|
Examples:
Source code in vedo/pyplot/functions.py
1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 | |
stats
CornerHistogram(values, bins=20, vrange=None, minbin=0, logscale=False, title='', c='g', bg='k', alpha=1, pos='bottom-left', s=0.175, lines=True, dots=False, nmax=None)
Build a histogram from a list of values in n bins. The resulting object is a 2D actor.
Use vrange to restrict the range of the histogram.
Use nmax to limit the sampling to this max nr of entries
Use pos to assign its position:
- 1, topleft,
- 2, topright,
- 3, bottomleft,
- 4, bottomright,
- (x, y), as fraction of the rendering window
Source code in vedo/pyplot/stats.py
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 | |
CornerPlot(points, pos=1, s=0.2, title='', c='b', bg='k', lines=True, dots=True)
Return a vtkXYPlotActor that is a plot of x versus y,
where points is a list of (x,y) points.
Assign position following this convention:
- 1, topleft,
- 2, topright,
- 3, bottomleft,
- 4, bottomright.
Source code in vedo/pyplot/stats.py
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 | |
matrix(M, title='Matrix', xtitle='', ytitle='', xlabels=(), ylabels=(), xrotation=0, cmap='Reds', vmin=None, vmax=None, precision=2, font='Theemim', scale=0, scalarbar=True, lc='white', lw=0, c='black', alpha=1)
Generate a matrix, or a 2D color-coded plot with bin labels.
Returns an Assembly object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
M
|
list, numpy array
|
the input array to visualize |
required |
title
|
str
|
title of the plot |
'Matrix'
|
xtitle
|
str
|
title of the horizontal colmuns |
''
|
ytitle
|
str
|
title of the vertical rows |
''
|
xlabels
|
list
|
individual string labels for each column. Must be of length m |
()
|
ylabels
|
list
|
individual string labels for each row. Must be of length n |
()
|
xrotation
|
float
|
rotation of the horizontal labels |
0
|
cmap
|
str
|
color map name |
'Reds'
|
vmin
|
float
|
minimum value of the colormap range |
None
|
vmax
|
float
|
maximum value of the colormap range |
None
|
precision
|
int
|
number of digits for the matrix entries or bins |
2
|
font
|
str
|
font name. Check available fonts here. |
'Theemim'
|
scale
|
float
|
size of the numeric entries or bin values |
0
|
scalarbar
|
bool
|
add a scalar bar to the right of the plot |
True
|
lc
|
str
|
color of the line separating the bins |
'white'
|
lw
|
float
|
Width of the line separating the bins |
0
|
c
|
str
|
text color |
'black'
|
alpha
|
float
|
plot transparency |
1
|
Examples:
Source code in vedo/pyplot/stats.py
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 | |
pie_chart(fractions, title='', tsize=0.3, r1=1.7, r2=1, phigap=0, lpos=0.8, lsize=0.15, c=None, bc='k', alpha=1, labels=(), show_disc=False)
Donut plot or pie chart.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
plot title |
''
|
tsize
|
float
|
title size |
0.3
|
r1
|
(float) inner radius |
required | |
r2
|
float
|
outer radius, starting from r1 |
1
|
phigap
|
float
|
gap angle btw 2 radial bars, in degrees |
0
|
lpos
|
float
|
label gap factor along radius |
0.8
|
lsize
|
float
|
label size |
0.15
|
c
|
color
|
color of the plot slices |
None
|
bc
|
color
|
color of the disc frame |
'k'
|
alpha
|
float
|
opacity of the disc frame |
1
|
labels
|
list
|
list of labels |
()
|
show_disc
|
bool
|
show the outer ring axis |
False
|
Examples:
Source code in vedo/pyplot/stats.py
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 | |
violin(values, bins=10, vlim=None, x=0, width=3, splined=True, fill=True, c='violet', alpha=1, outline=True, centerline=True, lc='darkorchid', lw=3)
Violin style histogram.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bins
|
int
|
number of bins |
10
|
vlim
|
list
|
input value limits. Crop values outside range |
None
|
x
|
float
|
x-position of the violin axis |
0
|
width
|
float
|
width factor of the normalized distribution |
3
|
splined
|
bool
|
spline the outline |
True
|
fill
|
bool
|
fill violin with solid color |
True
|
outline
|
bool
|
add the distribution outline |
True
|
centerline
|
bool
|
add the vertical centerline at x |
True
|
lc
|
color
|
line color |
'darkorchid'
|
Examples:
Source code in vedo/pyplot/stats.py
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 | |
whisker(data, s=0.25, c='k', lw=2, bc='blue', alpha=0.25, r=5, jitter=True, horizontal=False)
Generate a "whisker" bar from a 1-dimensional dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s
|
float
|
size of the box |
0.25
|
c
|
color
|
color of the lines |
'k'
|
lw
|
float
|
line width |
2
|
bc
|
color
|
color of the box |
'blue'
|
alpha
|
float
|
transparency of the box |
0.25
|
r
|
float
|
point radius in pixels (use value 0 to disable) |
5
|
jitter
|
bool
|
add some randomness to points to avoid overlap |
True
|
horizontal
|
bool
|
set horizontal layout |
False
|
Examples:
Source code in vedo/pyplot/stats.py
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 | |
graph
DirectedGraph
Bases: Assembly
Support for Directed Graphs.
Source code in vedo/pyplot/graph.py
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 | |
add_child(v, node_label='id', edge_label='')
Add a new edge to a new node as its child. The extra node is created automatically if needed.
Source code in vedo/pyplot/graph.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
add_edge(v1, v2, label='')
Add a new edge between to nodes. An extra node is created automatically if needed.
Source code in vedo/pyplot/graph.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
add_node(label='id')
Add a new node to the Graph.
Source code in vedo/pyplot/graph.py
247 248 249 250 251 252 253 254 | |
build()
Build the DirectedGraph(Assembly).
Accessory objects are also created for labels and arrows.
Source code in vedo/pyplot/graph.py
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 | |









