Skip to content

removing outdated code block examples #281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions fastplotlib/graphics/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,6 @@ def __init__(
**present**: :class:`.PresentFeature`
Control the presence of the Graphic in the scene

Examples
--------
.. code-block:: python

from fastplotlib import Plot
# create a `Plot` instance
plot = Plot()
# make some random 2D image data
data = np.random.rand(512, 512)
# plot the image data
plot.add_image(data=data)
# show the plot
plot.show()

"""

super().__init__(*args, **kwargs)
Expand Down Expand Up @@ -424,23 +410,6 @@ def __init__(
**present**: :class:`.PresentFeature`
Control the presence of the Graphic in the scene

Examples
--------
.. code-block:: python

from fastplotlib import Plot
# create a `Plot` instance
plot = Plot()

# make some random 2D heatmap data
data = np.random.rand(10_000, 8_000)

# add a heatmap
plot.add_heatmap(data=data)

# show the plot
plot.show()

"""

super().__init__(*args, **kwargs)
Expand Down
107 changes: 0 additions & 107 deletions fastplotlib/graphics/line_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,67 +83,8 @@ def __init__(

Collections support the same features as the underlying graphic. You just have to slice the selection.

.. code-block:: python

# slice only the collection
line_collection[10:20].colors = "blue"

# slice the collection and a feature
line_collection[20:30].colors[10:30] = "red"

# the data feature also works like this

See :class:`LineGraphic` details on the features.

Examples
--------
.. code-block:: python

from fastplotlib import Plot
from fastplotlib.graphics import LineCollection

# creating data for sine and cosine waves
xs = np.linspace(-10, 10, 100)
ys = np.sin(xs)

sine = np.dstack([xs, ys])[0]

ys = np.sin(xs) + 10
sine2 = np.dstack([xs, ys])[0]

ys = np.cos(xs) + 5
cosine = np.dstack([xs, ys])[0]

# creating plot
plot = Plot()

# creating a line collection using the sine and cosine wave data
line_collection = LineCollection(data=[sine, cosine, sine2], cmap=["Oranges", "Blues", "Reds"], thickness=20.0)

# add graphic to plot
plot.add_graphic(line_collection)

# show plot
plot.show()

# change the color of the sine wave to white
line_collection[0].colors = "w"

# change certain color indexes of the cosine data to red
line_collection[1].colors[0:15] = "r"

# toggle presence of sine2 and rescale graphics
line_collection[2].present = False

plot.autoscale()

line_collection[2].present = True

plot.autoscale()

# can also do slicing
line_collection[1:].colors[35:70] = "magenta"

"""

super(LineCollection, self).__init__(name)
Expand Down Expand Up @@ -596,56 +537,8 @@ def __init__(

Collections support the same features as the underlying graphic. You just have to slice the selection.

.. code-block:: python

# slice only the collection
line_collection[10:20].colors = "blue"

# slice the collection and a feature
line_collection[20:30].colors[10:30] = "red"

# the data feature also works like this

See :class:`LineGraphic` details on the features.


Examples
--------
.. code-block:: python

from fastplotlib import Plot
from fastplotlib.graphics import LineStack

# create plot
plot = Plot()

# create line data
xs = np.linspace(-10, 10, 100)
ys = np.sin(xs)

sine = np.dstack([xs, ys])[0]

ys = np.sin(xs)
cosine = np.dstack([xs, ys])[0]

# create line stack
line_stack = LineStack(data=[sine, cosine], cmap=["Oranges", "Blues"], thickness=20.0, separation=5.0)

# add graphic to plot
plot.add_graphic(line_stack)

# show plot
plot.show()

# change the color of the sine wave to white
line_stack[0].colors = "w"

# change certain color indexes of the cosine data to red
line_stack[1].colors[0:15] = "r"

# more slicing
line_stack[0].colors[35:70] = "magenta"

"""
super(LineStack, self).__init__(
data=data,
Expand Down
38 changes: 0 additions & 38 deletions fastplotlib/layouts/_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,44 +47,6 @@ def __init__(
kwargs
passed to Subplot, for example ``name``

Examples
--------

Simple example

.. code-block:: python

from fastplotlib import Plot

# create a `Plot` instance
plot1 = Plot()

# make some random 2D image data
data = np.random.rand(512, 512)

# plot the image data
plot1.add_image(data=data)

# show the plot
plot1.show()

Sharing controllers, start from the previous example and create a new jupyter cell

.. code-block:: python

# use the controller from the previous plot
# this will sync the pan & zoom controller
plot2 = Plot(controller=plot1.controller)

# make some random 2D image data
data = np.random.rand(512, 512)

# plot the image data
plot2.add_image(data=data)

# show the plot
plot2.show()

"""
super(Plot, self).__init__(
parent=None,
Expand Down
138 changes: 0 additions & 138 deletions fastplotlib/layouts/graphic_methods_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,6 @@ def add_heatmap(self, data: Any, vmin: int = None, vmax: int = None, cmap: str =
**present**: :class:`.PresentFeature`
Control the presence of the Graphic in the scene

Examples
--------
.. code-block:: python

from fastplotlib import Plot
# create a `Plot` instance
plot = Plot()

# make some random 2D heatmap data
data = np.random.rand(10_000, 8_000)

# add a heatmap
plot.add_heatmap(data=data)

# show the plot
plot.show()


"""
return self._create_graphic(HeatmapGraphic, data, vmin, vmax, cmap, filter, chunk_size, isolated_buffer, *args, **kwargs)
Expand Down Expand Up @@ -146,20 +129,6 @@ def add_image(self, data: Any, vmin: int = None, vmax: int = None, cmap: str = '
**present**: :class:`.PresentFeature`
Control the presence of the Graphic in the scene

Examples
--------
.. code-block:: python

from fastplotlib import Plot
# create a `Plot` instance
plot = Plot()
# make some random 2D image data
data = np.random.rand(512, 512)
# plot the image data
plot.add_image(data=data)
# show the plot
plot.show()


"""
return self._create_graphic(ImageGraphic, data, vmin, vmax, cmap, filter, isolated_buffer, *args, **kwargs)
Expand Down Expand Up @@ -218,67 +187,8 @@ def add_line_collection(self, data: List[numpy.ndarray], z_position: Union[List[

Collections support the same features as the underlying graphic. You just have to slice the selection.

.. code-block:: python

# slice only the collection
line_collection[10:20].colors = "blue"

# slice the collection and a feature
line_collection[20:30].colors[10:30] = "red"

# the data feature also works like this

See :class:`LineGraphic` details on the features.

Examples
--------
.. code-block:: python

from fastplotlib import Plot
from fastplotlib.graphics import LineCollection

# creating data for sine and cosine waves
xs = np.linspace(-10, 10, 100)
ys = np.sin(xs)

sine = np.dstack([xs, ys])[0]

ys = np.sin(xs) + 10
sine2 = np.dstack([xs, ys])[0]

ys = np.cos(xs) + 5
cosine = np.dstack([xs, ys])[0]

# creating plot
plot = Plot()

# creating a line collection using the sine and cosine wave data
line_collection = LineCollection(data=[sine, cosine, sine2], cmap=["Oranges", "Blues", "Reds"], thickness=20.0)

# add graphic to plot
plot.add_graphic(line_collection)

# show plot
plot.show()

# change the color of the sine wave to white
line_collection[0].colors = "w"

# change certain color indexes of the cosine data to red
line_collection[1].colors[0:15] = "r"

# toggle presence of sine2 and rescale graphics
line_collection[2].present = False

plot.autoscale()

line_collection[2].present = True

plot.autoscale()

# can also do slicing
line_collection[1:].colors[35:70] = "magenta"


"""
return self._create_graphic(LineCollection, data, z_position, thickness, colors, alpha, cmap, cmap_values, name, metadata, *args, **kwargs)
Expand Down Expand Up @@ -397,56 +307,8 @@ def add_line_stack(self, data: List[numpy.ndarray], z_position: Union[List[float

Collections support the same features as the underlying graphic. You just have to slice the selection.

.. code-block:: python

# slice only the collection
line_collection[10:20].colors = "blue"

# slice the collection and a feature
line_collection[20:30].colors[10:30] = "red"

# the data feature also works like this

See :class:`LineGraphic` details on the features.


Examples
--------
.. code-block:: python

from fastplotlib import Plot
from fastplotlib.graphics import LineStack

# create plot
plot = Plot()

# create line data
xs = np.linspace(-10, 10, 100)
ys = np.sin(xs)

sine = np.dstack([xs, ys])[0]

ys = np.sin(xs)
cosine = np.dstack([xs, ys])[0]

# create line stack
line_stack = LineStack(data=[sine, cosine], cmap=["Oranges", "Blues"], thickness=20.0, separation=5.0)

# add graphic to plot
plot.add_graphic(line_stack)

# show plot
plot.show()

# change the color of the sine wave to white
line_stack[0].colors = "w"

# change certain color indexes of the cosine data to red
line_stack[1].colors[0:15] = "r"

# more slicing
line_stack[0].colors[35:70] = "magenta"


"""
return self._create_graphic(LineStack, data, z_position, thickness, colors, cmap, separation, separation_axis, name, *args, **kwargs)
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy