diff --git a/docs/source/annotated_examples.rst b/docs/source/annotated_examples.rst index 1e9661adb..c1ba295bc 100644 --- a/docs/source/annotated_examples.rst +++ b/docs/source/annotated_examples.rst @@ -17,7 +17,7 @@ examples as starting points for their own applications. ----------------------- An example showing Chaco's BarPlot class. -source: `bar_plot_stacked.py `_ +source: :github-demo:`bar_plot_stacked.py `. .. image:: example_images/bar_plot.png @@ -33,7 +33,7 @@ of the backbuffering built into chaco. Zooming with the mousewheel and the zoombox (as described in simple_line.py) is also available, but panning is not. -source: `bigdata.py `_ +source: :github-demo:`bigdata.py `. .. image:: example_images/bigdata.png @@ -41,7 +41,7 @@ source: `bigdata.py `_ +source: :github-demo:`cmap_image_plot.py `. .. image:: example_images/cmap_image_plot.png @@ -50,7 +50,7 @@ source: `cmap_image_plot.py `_ +source: :github-demo:`cmap_image_select.py `. .. image:: example_images/cmap_image_select.png @@ -58,7 +58,7 @@ source: `cmap_image_select.py `_ +source: :github-demo:`cmap_scatter.py `. .. image:: example_images/cmap_scatter.png @@ -66,7 +66,7 @@ source: `cmap_scatter.py `_ +source: :github-demo:`countour_cmap_plot.py `. .. image:: example_images/contour_cmap_plot.png @@ -74,7 +74,7 @@ source: `countour_cmap_plot.py `_ +source: :github-demo:`countour_plot.py `. .. image:: example_images/contour_plot.png @@ -85,7 +85,7 @@ A Demonstration of the CursorTool functionality Left-button drag to move the cursors round. Right-drag to pan the plots. 'z'-key to Zoom -source: `cursor_tool_demo.py `_ +source: :github-demo:`cursor_tool_demo.py `. .. image:: example_images/cursor_tool_demo.png @@ -93,7 +93,7 @@ source: `cursor_tool_demo.py `_ +source: :github-demo:`data_cube.py `. .. image:: example_images/data_cube.png @@ -102,7 +102,7 @@ source: `data_cube.py `_ +source: :github-demo:`data_labels.py `. .. image:: example_images/data_labels.png @@ -117,7 +117,7 @@ device from which the data is being acquired; in this case, it is a mockup random number generator whose mean and standard deviation can be controlled by the user. -source: `data_stream.py `_ +source: :github-demo:`data_stream.py `. .. image:: example_images/data_stream.png @@ -125,7 +125,7 @@ source: `data_stream.py `_ +source: :github-demo:`data_view.py `. .. image:: example_images/data_view.png @@ -133,7 +133,7 @@ source: `data_view.py `_ +source: :github-demo:`edit_line.py `. .. image:: example_images/edit_line.png @@ -143,7 +143,7 @@ Implementation of a standard financial plot visualization using Chaco renderers and scales. Right-clicking and selecting an area in the top window zooms in the corresponding area in the lower window. -source: `financial_plot.py `_ +source: :github-demo:`financial_plot.py `. .. image:: example_images/financial_plot.png @@ -155,7 +155,7 @@ the corresopnding area in the lower window. This differs from the financial_plot.py example in that it uses a date-oriented axis. -source: `financial_plot_dates.py `_ +source: :github-demo:`financial_plot_dates.py `. .. image:: example_images/financial_plot_dates.png @@ -163,7 +163,7 @@ source: `financial_plot_dates.py `_ +source: :github-demo:`grid_container.py `. .. image:: example_images/grid_container.png @@ -172,7 +172,7 @@ source: `grid_container.py `_ +source: :github-demo:`grid_container_aspect_ratio.py `. .. image:: example_images/grid_container_aspect_ratio.png @@ -180,7 +180,7 @@ source: `grid_container_aspect_ratio.py `_ +source: :github-demo:`image_from_file.py `. .. image:: example_images/image_from_file.png @@ -189,7 +189,7 @@ source: `image_from_file.py `_ +source: :github-demo:`image_inspector.py `. .. image:: example_images/image_inspector.png @@ -197,7 +197,7 @@ source: `image_inspector.py `_ +source: :github-demo:`image_plot.py `. .. image:: example_images/image_plot.png @@ -207,7 +207,7 @@ A modification of line_plot1.py that shows the second plot as a subwindow of the first. You can pan and zoom the second plot just like the first, and you can move it around my right-click and dragging in the smaller plot. -source: `inset_plot.py `_ +source: :github-demo:`inset_plot.py `. .. image:: example_images/inset_plot.png @@ -216,7 +216,7 @@ source: `inset_plot.py `_ +source: :github-demo:`line_drawing.py `. .. image:: example_images/line_drawing.png @@ -224,7 +224,7 @@ source: `line_drawing.py `_ +source: :github-demo:`line_plot1.py `. .. image:: example_images/line_plot1.png @@ -232,7 +232,7 @@ source: `line_plot1.py `_ +source: :github-demo:`line_plot_hold.py `. .. image:: example_images/line_plot_hold.png @@ -240,7 +240,7 @@ source: `line_plot_hold.py `_ +source: :github-demo:`log_plot.py `. .. image:: example_images/log_plot.png @@ -250,7 +250,7 @@ Draws several overlapping line plots like simple_line.py, but uses a separate Y range for each plot. Also has a second Y-axis on the right hand side. Demonstrates use of the BroadcasterTool. -source: `multiaxis.py `_ +source: :github-demo:`multiaxis.py `. .. image:: example_images/multiaxis.png @@ -264,7 +264,7 @@ Draws some x-y line and scatter plots. On the left hand plot: and alt-right-arrow moves you forwards and backwards through the "zoom history". -source: `multiaxis_using_Plot.py `_ +source: :github-demo:`multiaxis_using_Plot.py `. .. image:: example_images/multiaxis_using_Plot.png @@ -272,7 +272,7 @@ source: `multiaxis_using_Plot.py `_ +source: :github-demo:`nans_plot.py `. .. image:: example_images/nans_plot.png @@ -281,7 +281,7 @@ source: `nans_plot.py `_ +source: :github-demo:`noninteractive.py `. .. image:: example_images/noninteractive.png @@ -290,7 +290,7 @@ source: `noninteractive.py `_ +source: :github-demo:`polygon_move.py `. .. image:: example_images/polygon_move.png @@ -298,7 +298,7 @@ source: `polygon_move.py `_ +source: :github-demo:`polygon_plot_demo.py `. .. image:: example_images/polygon_plot.png @@ -308,7 +308,7 @@ Demo of the RangeSelection on a line plot. Left-click and drag creates a horizontal range selection; this selection can then be dragged around, or resized by dragging its edges. -source: `range_selection_demo.py `_ +source: :github-demo:`range_selection_demo.py `. .. image:: example_images/range_selection_demo.png @@ -321,7 +321,7 @@ around some points, and a line fit is drawn through the center of the points. The parameters of the line are displayed at the bottom of the plot region. You can do this repeatedly to draw different regions. -source: `regression.py `_ +source: :github-demo:`regression.py `. .. image:: example_images/regression.png @@ -330,7 +330,7 @@ source: `regression.py `_ +source: :github-demo:`scalar_image_function_inspector.py `. .. image:: example_images/scalar_image_function_inspector.png @@ -340,7 +340,7 @@ Draws several overlapping line plots. Double-clicking on line or scatter plots opens a Traits editor for the plot. -source: `scales_test.py `_ +source: :github-demo:`scales_test.py `. .. image:: example_images/scales_test.png @@ -348,7 +348,7 @@ source: `scales_test.py `_ +source: :github-demo:`scatter.py `. .. image:: example_images/scatter.png @@ -356,7 +356,7 @@ source: `scatter.py `_ +source: :github-demo:`scatter_inspector.py `. .. image:: example_images/scatter_inspector.png @@ -367,7 +367,7 @@ the lasso selector, which allows you to circle a set of points. Upon completion of the lasso operation, the indices of the selected points are printed to the console. -source: `scatter_select.py `_ +source: :github-demo:`scatter_select.py `. .. image:: example_images/scatter_select.png @@ -382,7 +382,7 @@ console output:: ------------------- Draws some x-y line and scatter plots. -source: `scrollbar.py `_ +source: :github-demo:`scrollbar.py `. .. image:: example_images/scrollbar.png @@ -392,7 +392,7 @@ Draws several overlapping line plots. Double-clicking on line or scatter plots opens a Traits editor for the plot. -source: `simple_line.py `_ +source: :github-demo:`simple_line.py `. .. image:: images/simple_line.png @@ -402,7 +402,7 @@ source: `simple_line.py `_ + source: :github-demo:`simple_polar.py `. .. image:: example_images/simple_polar.png @@ -410,7 +410,7 @@ source: `simple_line.py `_ +source: :github-demo:`spectrum.py `. .. image:: example_images/spectrum.png @@ -418,7 +418,7 @@ source: `spectrum.py `_ +source: :github-demo:`tabbed_plots.py `. .. image:: example_images/tabbed_plots1.png .. image:: example_images/tabbed_plots2.png @@ -427,7 +427,7 @@ source: `tabbed_plots.py `_ +source: :github-demo:`tornado.py `. .. image:: example_images/tornado.png @@ -435,7 +435,7 @@ source: `tornado.py `_ +source: :github-demo:`two_plots.py `. .. image:: example_images/two_plots.png @@ -446,7 +446,7 @@ Draws a static plot of bessel functions, oriented vertically, side-by-side. You can experiment with using different containers (uncomment lines 32-33) or different orientations on the plots (comment out line 43 and uncomment 44). -source: `vertical_plot.py `_ +source: :github-demo:`vertical_plot.py `. .. image:: example_images/vertical_plot.png @@ -461,7 +461,7 @@ Left-click pans the colorbar's data region. Right-click-drag selects a zoom range. Mousewheel up and down zoom in and out on the data bounds of the color bar. -source: `zoomable_colorbar.py `_ +source: :github-demo:`zoomable_colorbar.py `. .. image:: example_images/zoomable_colorbar.png @@ -473,6 +473,6 @@ Right-click and drag on the upper plot to select a region to view in detail in the lower plot. The selected region can be moved around by dragging, or resized by clicking on one of its edges and dragging. -source: `zoomed_plot `_ +source: :github-demo:`zoomed_plot `. .. image:: example_images/zoomed_plot.png diff --git a/docs/source/conf.py b/docs/source/conf.py index ab8d68256..51d4099fa 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -29,6 +29,7 @@ def get_build_docset(): # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', + 'sphinx.ext.extlinks', 'sphinx.ext.napoleon', 'sphinx.ext.graphviz', 'sphinx.ext.intersphinx', @@ -223,6 +224,11 @@ def get_build_docset(): # If false, no module index is generated. #latex_use_modindex = True +extlinks = { + 'github-demo': ( + f'https://github.com/enthought/chaco/tree/{version}/%s', '' + ) +} intersphinx_mapping = { 'enable': ('http://docs.enthought.com/enable', None) diff --git a/docs/source/user_manual/chaco_tutorial.rst b/docs/source/user_manual/chaco_tutorial.rst index 38430c839..14faf82c7 100644 --- a/docs/source/user_manual/chaco_tutorial.rst +++ b/docs/source/user_manual/chaco_tutorial.rst @@ -1291,7 +1291,7 @@ This concludes this tutorial. You can download :download:`a PDF version of the s For further information, visit the :ref:`user_guide`. You can find the examples for this tutorial in the :file:`examples/tutorials/scipy2008/` directory of the Chaco source code. You can browse it online in the -`GitHub repository `_ +:github-demo:`GitHub repository ` if you don't have a local copy. They are numbered and introduce concepts one at a time, going from a simple line plot to building a custom overlay with its own trait editor and reusing an existing tool from the built-in set of tools. diff --git a/docs/source/user_manual/tutorial_hyetograph.rst b/docs/source/user_manual/tutorial_hyetograph.rst index d69aa4480..63b0c7716 100644 --- a/docs/source/user_manual/tutorial_hyetograph.rst +++ b/docs/source/user_manual/tutorial_hyetograph.rst @@ -351,7 +351,7 @@ Source Code =========== The final version of the program, -`hyetograph.py `_. +:github-demo:`hyetograph.py `. .. literalinclude:: /../../chaco/examples/demo/hyetograph.py :language: python diff --git a/docs/source/user_manual/tutorial_van_der_waal.rst b/docs/source/user_manual/tutorial_van_der_waal.rst index 00782c34d..c5d64b276 100644 --- a/docs/source/user_manual/tutorial_van_der_waal.rst +++ b/docs/source/user_manual/tutorial_van_der_waal.rst @@ -319,7 +319,7 @@ Source Code =========== The final version of the program, -`vanderwaals.py `_ +:github-demo:`vanderwaals.py `. .. literalinclude:: /../../chaco/examples/demo/vanderwaals.py :language: python