Skip to content

Commit

Permalink
Added plt.close to doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklise committed May 7, 2024
1 parent 8d3ff08 commit ea7d97a
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 13 deletions.
3 changes: 2 additions & 1 deletion documentation/disaster_models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ The earthquake properties can be plotted on the network using the following exam

>>> plt.tight_layout()
>>> plt.savefig('network_pga.png', dpi=300)

>>> plt.close()

.. _fig-network:
.. figure:: figures/network_pga.png
:width: 640
Expand Down
4 changes: 3 additions & 1 deletion documentation/fragility.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ The following example defines a fragility curve with two damage states: Minor da

>>> plt.tight_layout()
>>> plt.savefig('fragility_curve.png', dpi=300)
>>> plt.close()

:numref:`fig-fragility` illustrates the fragility curve as a function of peak ground acceleration.
For example, if the peak ground acceleration is 0.3 at
Expand Down Expand Up @@ -108,7 +109,8 @@ To plot the damage state on the network, the state (i.e., Major) can be converte

>>> plt.tight_layout()
>>> plt.savefig('damage_state.png', dpi=300)

>>> plt.close()

.. _fig-damage-state:
.. figure:: figures/damage_state.png
:width: 640
Expand Down
7 changes: 6 additions & 1 deletion documentation/gis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ the hydrants snapped to the junctions in Net1.
>>> bounds = ax.axis('equal')
>>> plt.tight_layout()
>>> plt.savefig('snap_points.png', dpi=300)
>>> plt.close()

.. _fig-snap-points:
.. figure:: figures/snap_points.png
Expand Down Expand Up @@ -511,6 +512,7 @@ illustrates the valve layer created by snapping points to lines in Net1.
>>> bounds = ax.axis('equal')
>>> plt.tight_layout()
>>> plt.savefig('snap_lines.png', dpi=300)
>>> plt.close()

.. _fig-snap-lines:
.. figure:: figures/snap_lines.png
Expand Down Expand Up @@ -615,7 +617,8 @@ The pipes are colored based upon their maximum earthquake probability.
>>> bounds = ax.axis('equal')
>>> plt.tight_layout()
>>> plt.savefig('intersect_earthquake.png', dpi=300)

>>> plt.close()

.. _fig-intersect-earthquake:
.. figure:: figures/intersect_earthquake.png
:width: 640
Expand Down Expand Up @@ -699,6 +702,7 @@ The pipes are colored based upon their weighted mean landslide probability.
>>> bounds = ax.axis('equal')
>>> plt.tight_layout()
>>> plt.savefig('intersect_landslide.png', dpi=300)
>>> plt.close()

.. _fig-intersect-landslide:
.. figure:: figures/intersect_landslide.png
Expand Down Expand Up @@ -807,6 +811,7 @@ the census tracts (polygons) is different than the junction and pipe attributes.
>>> bounds = ax.axis('equal')
>>> plt.tight_layout()
>>> plt.savefig('intersect_demographics.png', dpi=300)
>>> plt.close()

.. _fig-intersect-demographics:
.. figure:: figures/intersect_demographics.png
Expand Down
19 changes: 13 additions & 6 deletions documentation/graphics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ which can be further customized by the user.

>>> plt.tight_layout()
>>> plt.savefig('plot_basic_network.png', dpi=300)

>>> plt.close()

.. _fig-network-2:
.. figure:: figures/plot_basic_network.png
:width: 640
Expand Down Expand Up @@ -118,7 +119,8 @@ See https://matplotlib.org for more colormap options.

>>> plt.tight_layout()
>>> plt.savefig('plot_subplot_basic_network.png', dpi=300)

>>> plt.close()

.. _fig-network-3:
.. figure:: figures/plot_subplot_basic_network.png
:width: 800
Expand Down Expand Up @@ -267,7 +269,8 @@ The following example uses simulation results from above, and converts the graph

>>> plt.tight_layout()
>>> plt.savefig('plot_pump_curve.png', dpi=300)

>>> plt.close()

.. _fig-interactive-timeseries:
.. figure:: figures/interactive_timeseries.png
:width: 640
Expand Down Expand Up @@ -331,7 +334,8 @@ The following example plots a pump curve (:numref:`fig-pump`).

>>> plt.tight_layout()
>>> plt.savefig('plot_pump_curve.png', dpi=300)

>>> plt.close()

.. _fig-pump:
.. figure:: figures/plot_pump_curve.png
:width: 640
Expand Down Expand Up @@ -380,7 +384,8 @@ level of the tank is included in the figure.

>>> plt.tight_layout()
>>> plt.savefig('plot_tank_volume_curve.png', dpi=300)

>>> plt.close()

.. _fig-tank:
.. figure:: figures/plot_tank_volume_curve.png
:width: 800
Expand Down Expand Up @@ -420,6 +425,7 @@ The valves and valve segments are plotted on the network (:numref:`fig-valve_seg

>>> plt.tight_layout()
>>> plt.savefig('plot_valve_segment.png', dpi=300)
>>> plt.close()

.. _fig-valve_segment:
.. figure:: figures/plot_valve_segment.png
Expand Down Expand Up @@ -447,7 +453,8 @@ valves surrounding each valve is plotted on the network

>>> plt.tight_layout()
>>> plt.savefig('plot_valve_segment_attributes.png', dpi=300)

>>> plt.close()

.. _fig-valve_segment_attributes:
.. figure:: figures/plot_valve_segment_attributes.png
:width: 640
Expand Down
2 changes: 2 additions & 0 deletions documentation/layers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ The valve layer can be included in water network graphics (:numref:`fig-random-v

>>> plt.tight_layout()
>>> plt.savefig('random_valve_layer.png', dpi=300)
>>> plt.close()

.. _fig-random-valve-layer:
.. figure:: figures/random_valve_layer.png
Expand All @@ -104,6 +105,7 @@ The valve layer can be included in water network graphics (:numref:`fig-strategi

>>> plt.tight_layout()
>>> plt.savefig('strategic_valve_layer.png', dpi=300)
>>> plt.close()

.. _fig-strategic-valve-layer:
.. figure:: figures/strategic_valve_layer.png
Expand Down
6 changes: 4 additions & 2 deletions documentation/morph.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ approximately 3000 to approximately 1000 (:numref:`fig-skel-example`).

>>> plt.tight_layout()
>>> plt.savefig('skel_example.png', dpi=300)

>>> plt.close()

.. _fig-skel-example:
.. figure:: figures/skel_example.png
:width: 800
Expand Down Expand Up @@ -202,7 +203,8 @@ Pressure differences are very small in this example.

>>> plt.tight_layout()
>>> plt.savefig('skel_hydraulics.png', dpi=300)

>>> plt.close()

.. _fig-skel-hydraulics:
.. figure:: figures/skel_hydraulics.png
:width: 640
Expand Down
6 changes: 4 additions & 2 deletions documentation/resultsobject.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ Data can be plotted as a time series, as shown in :numref:`fig-plot-timeseries`:

>>> plt.tight_layout()
>>> plt.savefig('plot_timeseries.png', dpi=300)

>>> plt.close()

.. _fig-plot-timeseries:
.. figure:: figures/plot_timeseries.png
:width: 640
Expand Down Expand Up @@ -182,7 +183,8 @@ plotted in a similar manner.

>>> plt.tight_layout()
>>> plt.savefig('plot_network.png', dpi=300)

>>> plt.close()

.. _fig-plot-network:
.. figure:: figures/plot_network.png
:width: 640
Expand Down

0 comments on commit ea7d97a

Please sign in to comment.