Skip to content
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

Miscellaneous documentation fixes/changes #642

Merged
merged 5 commits into from
Apr 12, 2021
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
6 changes: 3 additions & 3 deletions chaco/plot_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ class PlotComponent(Component):
#:
#: 1. 'background': Background image, shading
#: 2. 'image': A special layer for plots that render as images. This is in
#: a separate layer since these plots must all render before non-image
#: plots.
#: a separate layer since these plots must all render before non-image
#: plots.
#: 3. 'underlay': Axes and grids
#: 4. 'plot': The main plot area itself
#: 5. 'selection': Selected content are rendered above normal plot elements
#: to make them stand out
#: to make them stand out
#: 6. 'border': Plot borders
#: 7. 'annotation': Lines and text that are conceptually part of the "plot"
#: but need to be rendered on top of everything else in the plot
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ visualizations. Chaco facilitates writing plotting applications at all levels
of complexity, from simple scripts with hard-coded data to large plotting
programs with complex data interrelationships and a multitude of interactive
tools. While Chaco generates attractive static plots for publication and
presentation, Chaco differs from tools like MatPlotLib in that it also works
presentation, Chaco differs from tools like Matplotlib in that it also works
well for dynamic interactive data visualization and exploration. Chaco is part
of the Enthought Tool Suite.

Expand Down
2 changes: 1 addition & 1 deletion docs/source/user_manual/basic_elements/data_sources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ This is a list of all concrete implementations of data sources in Chaco:
:attr:`~chaco.function_data_source.FunctionDataSource.data_range`).


:class:`~chaco.function_data_source.FunctionImageData`
:class:`~chaco.function_image_data.FunctionImageData`
A subclass of :class:`~chaco.array_data_source.ImageData` that
sets the values of the underlying data array based on a 2D function
(defined in the callable attribute
Expand Down
53 changes: 28 additions & 25 deletions docs/source/user_manual/basic_elements/overlays.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ of their interface with :ref:`plot renderers <plot_renderers>`

In addition, they have a lightweight interface defined in
:class:`chaco.abstract_overlay.AbstractOverlay`: the additional
features are that 1) they keep a reference to the plot they are decorating in
:attr:`~chaco.abstract_overlay.AbstractOverlay.component`;
2) the background color
:attr:`~chaco.abstract_overlay.AbstractOverlay.bgcolor`
is 'transparent' by default;
3) they plot :ref:`on the 'overlay' layer <plot_layers>` by default.
features are that

1. they keep a reference to the plot they are decorating in
:attr:`~chaco.abstract_overlay.AbstractOverlay.component`;
2. the background color :attr:`~chaco.abstract_overlay.AbstractOverlay.bgcolor`
is 'transparent' by default;
3. they plot :ref:`on the 'overlay' layer <plot_layers>` by default.

.. TODO: explain how to attach an overlay to an existing plot renderer

Expand Down Expand Up @@ -49,11 +49,13 @@ given an X-Y plot renderer, ``plot``, we can define a new x-axis as: ::
'title_font': 'modern 20',
}

x_axis = PlotAxis(orientation='bottom',
title='My x axis',
mapper=plot.x_mapper,
component=plot,
**AXIS_DEFAULTS)
x_axis = PlotAxis(
orientation='bottom',
title='My x axis',
mapper=plot.x_mapper,
component=plot,
**AXIS_DEFAULTS,
)

The newly created axis can then be attached to the plot renderer by
appending it to its underlays layer: ::
Expand All @@ -71,15 +73,19 @@ A :class:`~chaco.axis.MinorPlotAxis` should be added along with a
:class:`~chaco.axis.PlotAxis`. For example, minor axis tick marks can be
added with: ::

x_major_axis = PlotAxis(orientation='bottom',
title='My x axis',
mapper=plot.x_mapper,
component=plot)
x_major_axis = PlotAxis(
orientation='bottom',
title='My x axis',
mapper=plot.x_mapper,
component=plot,
)
plot.underlays.append(x_major_axis)

x_minor_axis = MinorPlotAxis(orientation='bottom',
mapper=plot.x_mapper,
component=plot)
x_minor_axis = MinorPlotAxis(
orientation='bottom',
mapper=plot.x_mapper,
component=plot,
)
plot.underlays.append(x_minor_axis)

Attributes
Expand Down Expand Up @@ -178,13 +184,10 @@ designed to draw a text box over the plots to display custom information.

The rendering of the text can be customized with the following attributes:

* :attr:`bgcolor` and :attr:`border_visible` to control the styling of the
box,
* :attr:`alpha` to control the transparency of the text box,
* :attr:`text_color` and :attr:`font` to control how the text looks like,
* :attr:`align` to control what corner of the plot the text box should
appear,
* ...
* :attr:`bgcolor` and :attr:`border_visible` to control the styling of the box,
* :attr:`alpha` to control the transparency of the text box,
* :attr:`text_color` and :attr:`font` to control how the text looks like,
* :attr:`align` to control what corner of the plot the text box should appear,

.. note:: The overlay can also be used directly by any custom tool that needs
to display information upon an event. It should be done by
Expand Down
11 changes: 4 additions & 7 deletions docs/source/user_manual/basic_elements/plot_renderers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,16 @@ of the names of the layers. The definition of the layers is as follows:

4. **plot**: The main plot area itself

5. **annotation**: Lines and text that are conceptually part of the "plot" but
need to be rendered on top of everything else in the plot.

6. **selection**: Selected content are rendered above normal plot elements to
5. **selection**: Selected content are rendered above normal plot elements to
make them stand out. This can be disabled by setting :attr:`use_selection`
to False (default).

7. **border**: Plot borders
6. **border**: Plot borders

8. **annotation**: Lines and text that are conceptually part of the "plot" but
7. **annotation**: Lines and text that are conceptually part of the "plot" but
need to be rendered on top of everything else in the plot

9. **overlay**: Legends, selection regions, and other tool-drawn visual
8. **overlay**: Legends, selection regions, and other tool-drawn visual
elements

Concrete plot renderers set their default draw layer in
Expand Down
15 changes: 9 additions & 6 deletions docs/source/user_manual/basic_elements/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ and the overlay catches these events and displays the data as an overlay.

To use it, as for other tools, you need to:

1. create a tool object and append it to the **renderer**'s list of tools,
2. create an overlay object and append it to the **renderer**'s list of
overlays.
1. create a tool object and append it to the **renderer**'s list of tools,
2. create an overlay object and append it to the **renderer**'s list of
overlays.

For example, a method to build a :class:`chaco.api.Plot` object with that tool
could look like::
Expand All @@ -95,9 +95,12 @@ will need it. The tool code to be inserted would look something like this::

imgtool = ImageInspectorTool(component=img_plot)
img_plot.tools.append(imgtool)
overlay = ImageInspectorOverlay(component=img_plot, image_inspector=imgtool,
bgcolor="white", border_visible=True)

overlay = ImageInspectorOverlay(
component=img_plot,
image_inspector=imgtool,
bgcolor="white",
border_visible=True
)
img_plot.overlays.append(overlay)

Note the two important connections that are made for the tool/overlay to work
Expand Down
Loading