Skip to content

Commit

Permalink
Doc string formatting for show1D (#2027)
Browse files Browse the repository at this point in the history
* Doc string formatting for show1D

---------

Signed-off-by: Gemma Fardell <[email protected]>
Co-authored-by: Hannah Robarts <[email protected]>
  • Loading branch information
gfardell and hrobarts authored Jan 9, 2025
1 parent c79eda4 commit f0f97a4
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions Wrappers/Python/cil/utilities/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,12 @@ def set_origin(data, origin):
class show_base(object):
def save(self,filename, **kwargs):
'''
Saves the image as a `.png` using matplotlib.figure.savefig()
Saves the image using matplotlib.figure.savefig(). Default format is png if no extension is provided.
matplotlib kwargs can be passed, refer to documentation
https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.savefig.html
Returns
-------
matplotlib.figure.Figure
returns a matplotlib.pyplot figure object
'''

file,extension = os.path.splitext(os.path.abspath(filename))
extension = extension.strip('.')

Expand Down Expand Up @@ -139,10 +134,12 @@ class show1D(show_base):
Note
----
The figure can be saved using the `save` method . i.e.
>>> fig = show2D(data, title='My Plot')
The figure can be saved using the `save` method . i.e:
>>> fig = show1D(data, title='My Plot')
>>> fig.save('/path/to/output.png')
Examples
--------
Expand Down Expand Up @@ -190,6 +187,7 @@ class show1D(show_base):
To save the figure, use the `save` method.
>>> from cil.utilities.display import show1D
>>> from cil.utilities import dataexample
>>> data = dataexample.SIMULATED_SPHERE_VOLUME.get()
Expand Down Expand Up @@ -426,9 +424,11 @@ class show2D(show_base):
Note
----
The figure can be saved using the `save` method . i.e.
The figure can be saved using the `save` method . i.e:
>>> fig = show2D(data, title='My Plot')
>>> fig.save('/path/to/output.png')
'''

def __init__(self,datacontainers, title=None, slice_list=None, fix_range=False, axis_labels=None, origin='lower-left', cmap='gray', num_cols=2, size=(15,15)):
Expand Down Expand Up @@ -1060,9 +1060,11 @@ class show_geometry(show_base):
Note
----
The figure can be saved using the `save` method . i.e.
>>> fig = show2D(data, title='My Plot')
The figure can be saved using the `save` method . i.e:
>>> fig = show_geometry(geometry)
>>> fig.save('/path/to/output.png')
'''


Expand Down

0 comments on commit f0f97a4

Please sign in to comment.