|
463 | 463 | "id": "5694dca1-1041-4e09-a1da-85b293c5af47", |
464 | 464 | "metadata": {}, |
465 | 465 | "source": [ |
466 | | - "### RGB images are also supported\n", |
| 466 | + "### RGB(A) images are supported\n", |
467 | 467 | "\n", |
468 | 468 | "`cmap` arguments are ignored for rgb images, but vmin vmax still works" |
469 | 469 | ] |
|
538 | 538 | "source": [ |
539 | 539 | "### Image updates\n", |
540 | 540 | "\n", |
541 | | - "This examples show how you can define animation functions that run on every render cycle." |
| 541 | + "This example shows how you can define animation functions that run on every render cycle." |
542 | 542 | ] |
543 | 543 | }, |
544 | 544 | { |
|
620 | 620 | "id": "f226c9c2-8d0e-41ab-9ab9-1ae31fd91de5", |
621 | 621 | "metadata": {}, |
622 | 622 | "source": [ |
623 | | - "#### Keeping a reference to the Graphic instance, as shown above `image_graphic_instance`, is useful if you're creating something where you need flexibility in the naming of the graphics" |
| 623 | + "#### Keeping a reference to the Graphic instance, as shown above `image_graphic_instance`, is useful if you're creating something where it is convenient to keep your own reference to a `Graphic`" |
624 | 624 | ] |
625 | 625 | }, |
626 | 626 | { |
627 | 627 | "cell_type": "markdown", |
628 | 628 | "id": "d11fabb7-7c76-4e94-893d-80ed9ee3be3d", |
629 | 629 | "metadata": {}, |
630 | 630 | "source": [ |
631 | | - "### You can also use `ipywidgets.VBox` and `HBox` to stack plots. See the `subplot` notebooks for more automated subplotting" |
| 631 | + "### You can also use `ipywidgets.VBox` and `HBox` to stack plots." |
632 | 632 | ] |
633 | 633 | }, |
634 | 634 | { |
|
664 | 664 | "\n", |
665 | 665 | "## 2D line plots\n", |
666 | 666 | "\n", |
667 | | - "This example plots a sine wave, cosine wave, and ricker wavelet and demonstrates how **Graphic Features** can be modified by slicing!" |
| 667 | + "This example plots a sine wave, cosine wave, and ricker wavelet and demonstrates how **Graphic Properties** can be modified by slicing!" |
668 | 668 | ] |
669 | 669 | }, |
670 | 670 | { |
|
755 | 755 | "\n", |
756 | 756 | "Set `maintain_aspect = False` on a camera, and then use the right mouse button and move the mouse to stretch and squeeze the view!\n", |
757 | 757 | "\n", |
758 | | - "You can also click the **`1:1`** button to toggle this, or use `subplot.camera.maintain_aspect`" |
| 758 | + "You can also click the **`⛶`** button to toggle this, or use `subplot.camera.maintain_aspect`" |
759 | 759 | ] |
760 | 760 | }, |
761 | 761 | { |
762 | 762 | "cell_type": "markdown", |
763 | 763 | "id": "1651e965-f750-47ac-bf53-c23dae84cc98", |
764 | 764 | "metadata": {}, |
765 | 765 | "source": [ |
766 | | - "### reset the plot area" |
| 766 | + "### reset the plot area camera" |
767 | 767 | ] |
768 | 768 | }, |
769 | 769 | { |
|
783 | 783 | "id": "dcd68796-c190-4c3f-8519-d73b98ff6367", |
784 | 784 | "metadata": {}, |
785 | 785 | "source": [ |
786 | | - "## Graphic features support slicing! :D " |
| 786 | + "## Graphic properties support slicing! :D\n", |
| 787 | + "\n", |
| 788 | + "Data, colors, and cmaps can often be sliced just like arrays to set or get values!" |
787 | 789 | ] |
788 | 790 | }, |
789 | 791 | { |
|
811 | 813 | "id": "c9689887-cdf3-4a4d-948f-7efdb09bde4e", |
812 | 814 | "metadata": {}, |
813 | 815 | "source": [ |
814 | | - "## You can capture changes to a graphic feature as events" |
| 816 | + "## Graphic properties are _evented_, so you can capture when they change" |
815 | 817 | ] |
816 | 818 | }, |
817 | 819 | { |
|
1551 | 1553 | " subplot.add_image(data, name=\"rand-img\")\n", |
1552 | 1554 | "\n", |
1553 | 1555 | "# Define a function to update the image graphics with new data\n", |
1554 | | - "# add_animations will pass the gridplot to the animation function\n", |
| 1556 | + "# add_animations will pass the figure to the animation function\n", |
1555 | 1557 | "def update_data(f):\n", |
1556 | 1558 | " for subplot in f:\n", |
1557 | 1559 | " new_data = np.random.rand(512, 512)\n", |
|
1561 | 1563 | "# add the animation function\n", |
1562 | 1564 | "figure_grid.add_animations(update_data)\n", |
1563 | 1565 | "\n", |
1564 | | - "# show the gridplot\n", |
| 1566 | + "# show the figure\n", |
1565 | 1567 | "figure_grid.show()" |
1566 | 1568 | ] |
1567 | 1569 | }, |
|
1575 | 1577 | } |
1576 | 1578 | }, |
1577 | 1579 | "source": [ |
1578 | | - "### Slicing GridPlot" |
| 1580 | + "### Slicing a grid layout to get subplots" |
1579 | 1581 | ] |
1580 | 1582 | }, |
1581 | 1583 | { |
|
1605 | 1607 | } |
1606 | 1608 | }, |
1607 | 1609 | "source": [ |
1608 | | - "You can get the graphics within a subplot, just like with simple `Plot`" |
| 1610 | + "You can get the graphics within a subplot" |
1609 | 1611 | ] |
1610 | 1612 | }, |
1611 | 1613 | { |
|
1661 | 1663 | } |
1662 | 1664 | }, |
1663 | 1665 | "source": [ |
1664 | | - "more slicing with `GridPlot`" |
| 1666 | + "more slicing with a `Figure` that has a grid layout" |
1665 | 1667 | ] |
1666 | 1668 | }, |
1667 | 1669 | { |
|
1707 | 1709 | }, |
1708 | 1710 | "outputs": [], |
1709 | 1711 | "source": [ |
1710 | | - "# these are really the same\n", |
| 1712 | + "# these are the same\n", |
1711 | 1713 | "figure_grid[\"top-right-plot\"] is figure_grid[0, 2]" |
1712 | 1714 | ] |
1713 | 1715 | }, |
|
1749 | 1751 | } |
1750 | 1752 | }, |
1751 | 1753 | "source": [ |
1752 | | - "## Figure subplot customization" |
| 1754 | + "## Figure subplot customization in a grid layout" |
1753 | 1755 | ] |
1754 | 1756 | }, |
1755 | 1757 | { |
|
1776 | 1778 | "]\n", |
1777 | 1779 | "\n", |
1778 | 1780 | "\n", |
1779 | | - "# you can give string names for each subplot within the gridplot\n", |
| 1781 | + "# you can give string names for each subplot within the figure\n", |
1780 | 1782 | "names = [\n", |
1781 | 1783 | " [\"subplot0\", \"subplot1\", \"subplot2\"],\n", |
1782 | 1784 | " [\"subplot3\", \"subplot4\", \"subplot5\"]\n", |
1783 | 1785 | "]\n", |
1784 | 1786 | "\n", |
1785 | | - "# Create the grid plot\n", |
| 1787 | + "# Create the figure\n", |
1786 | 1788 | "figure_grid = fpl.Figure(\n", |
1787 | 1789 | " shape=shape,\n", |
1788 | 1790 | " controller_ids=controller_ids,\n", |
|
1819 | 1821 | } |
1820 | 1822 | }, |
1821 | 1823 | "source": [ |
1822 | | - "Indexing the gridplot to access subplots" |
| 1824 | + "Slicing/indexing the figure to get subplots" |
1823 | 1825 | ] |
1824 | 1826 | }, |
1825 | 1827 | { |
|
1834 | 1836 | }, |
1835 | 1837 | "outputs": [], |
1836 | 1838 | "source": [ |
1837 | | - "# can access subplot by name\n", |
| 1839 | + "# get subplot by name\n", |
1838 | 1840 | "figure_grid[\"subplot0\"]" |
1839 | 1841 | ] |
1840 | 1842 | }, |
|
1850 | 1852 | }, |
1851 | 1853 | "outputs": [], |
1852 | 1854 | "source": [ |
1853 | | - "# can access subplot by index\n", |
| 1855 | + "# or get subplot by index\n", |
1854 | 1856 | "figure_grid[0, 0]" |
1855 | 1857 | ] |
1856 | 1858 | }, |
|
1864 | 1866 | } |
1865 | 1867 | }, |
1866 | 1868 | "source": [ |
1867 | | - "**subplots also support indexing!**\n", |
| 1869 | + "**from before, remember subplots themselves also support slicing to get graphics within them!**\n", |
1868 | 1870 | "\n", |
1869 | 1871 | "this can be used to get graphics if they are named" |
1870 | 1872 | ] |
|
1885 | 1887 | "figure_grid[\"subplot0\"][\"rand-image\"]" |
1886 | 1888 | ] |
1887 | 1889 | }, |
| 1890 | + { |
| 1891 | + "cell_type": "code", |
| 1892 | + "execution_count": null, |
| 1893 | + "id": "87905450bdc0ec0a", |
| 1894 | + "metadata": {}, |
| 1895 | + "outputs": [], |
| 1896 | + "source": [ |
| 1897 | + "# or by their numerical index\n", |
| 1898 | + "figure_grid[\"subplot0\"].graphics[0]" |
| 1899 | + ] |
| 1900 | + }, |
1888 | 1901 | { |
1889 | 1902 | "cell_type": "code", |
1890 | 1903 | "execution_count": null, |
|
1911 | 1924 | } |
1912 | 1925 | }, |
1913 | 1926 | "source": [ |
1914 | | - "positional indexing also works event if subplots have string names" |
| 1927 | + "positional indexing also works even if subplots have string names" |
1915 | 1928 | ] |
1916 | 1929 | }, |
1917 | 1930 | { |
|
0 commit comments