Skip to content

Commit

Permalink
update colours, docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
brlec committed Mar 19, 2021
1 parent 47fdc00 commit ddb1675
Showing 1 changed file with 9 additions and 23 deletions.
32 changes: 9 additions & 23 deletions surfaxe/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ def plot_bond_analysis(bond, df=None, filename=None, width=6, height=5, dpi=300,
color (`str`, optional): Color of marker. Defaults to ``None`` which
defaults to surfaxe base style
plt_fname (`str`, optional): Filename of the plot. Defaults to
``'bond_analysis.png'``. If name with no format suffix is supplied,
the format defaults to png.
``'bond_analysis.png'``.
Returns:
None, saves plot to bond_analysis.png
Expand All @@ -216,10 +215,7 @@ def plot_bond_analysis(bond, df=None, filename=None, width=6, height=5, dpi=300,
warnings.warn('Data not supplied')

if color is None:
color = '#FF596A'

if not plt_fname.endswith('.png'):
plt_fname += '.png'
color = '#F95F6E'

fig, ax = plt.subplots(1,1, dpi=dpi, figsize=(width, height))
x = df['{}_c_coord'.format(bond[0])]
Expand Down Expand Up @@ -250,8 +246,7 @@ def plot_electrostatic_potential(df=None, filename=None, dpi=300, width=6,
potential plots. Defaults to ``None``, which defaults to surfaxe
base style.
plt_fname (`str`, optional): Filename of the plot. Defaults to
``'potential.png'``. If name with no format suffix is supplied,
the format defaults to png.
``'potential.png'``.
Returns:
None, saves plot to potential.png
Expand All @@ -265,10 +260,7 @@ def plot_electrostatic_potential(df=None, filename=None, dpi=300, width=6,
warnings.warn('Data not supplied')

if colors==None or len(colors)<2:
colors = ['#FFADB6', '#FF596A']

if not plt_fname.endswith('.png'):
plt_fname += '.png'
colors = ['#FE8995', '#E6505F']

# Plot both planar and macroscopic, save figure
fig, ax = plt.subplots(1,1, dpi=dpi, figsize=(width, height))
Expand Down Expand Up @@ -304,14 +296,11 @@ def plot_surfen(df, joules=True, time_taken=True, colors=None, dpi=300, width=6,
Defaults to False.
cmap (`str`, optional): Matplotlib colourmap. Defaults to 'Wistia'
plt_fname (`str`, optional): The name of the plot. Defaults to
``surface_energy.png``. If name with no format suffix is supplied,
the format defaults to png.
``surface_energy.png``.
Returns:
None, saves surface_energy.png to file
"""
if not plt_fname.endswith('.png'):
plt_fname += '.png'

indices, vals, times, dfs, dfs_times = ([] for i in range(5))

Expand Down Expand Up @@ -416,8 +405,8 @@ def plot_surfen(df, joules=True, time_taken=True, colors=None, dpi=300, width=6,
else:
# Make the colour cycler with custom colours
if colors is None:
custom_cycler = (cycler(color=['#FFADB6','#FF596A','#CC4755',
'#802D35','#E6505F','#40161A','#CC858C']))
custom_cycler = (cycler(color=['#FE8995','#FE7B88','#E6505F',
'#CC4755','#9A323C','#802D35','#64232A', '#40161A']))
else:
custom_cycler = (cycler(color=colors))

Expand Down Expand Up @@ -537,9 +526,6 @@ def plot_enatom(df, time_taken=True, colors=None, dpi=300, width=6, height=5,
Returns:
None, saves energy_per_atom.png
"""
if not plt_fname.endswith('.png'):
plt_fname += '.png'

indices, vals, times, dfs, dfs_times = ([] for i in range(5))

# Group the values by termination slab index, create df for time and
Expand Down Expand Up @@ -646,8 +632,8 @@ def plot_enatom(df, time_taken=True, colors=None, dpi=300, width=6, height=5,

# Make the colour cycler with custom colours
if colors is None:
custom_cycler = (cycler(color=['#FFADB6','#FF596A','#CC4755',
'#802D35','#E6505F','#40161A','#CC858C']))
custom_cycler = (cycler(color=['#FE8995','#FE7B88','#E6505F',
'#CC4755','#9A323C','#802D35','#64232A', '#40161A']))
else:
custom_cycler = (cycler(color=colors))

Expand Down

0 comments on commit ddb1675

Please sign in to comment.