Skip to content

Option to return plt #8

@zliebersbach

Description

@zliebersbach

Hi, firstly thanks for publishing this library!

We would like to use the library but require the plt object returned instead of the plot written to a file.

Would it be OK if I submitted a PR to do the following across all files (this example is for triangle_piper.py):

  1. Extra argument, retplt, which returns the plt object:
def plot(df, 
         unit='mg/L', 
         figname='triangle Piper diagram', 
         figformat='jpg',
         retplt=False): # <- new!
  1. Returns plot if retplt is true instead of writing file:
if retplt:
    return plt
else:
    # Display the info
    cwd = os.getcwd()
    print("Trilinear Piper plot created. Saving it to %s \n" %cwd)
    
    # Save the figure
    plt.savefig(figname + '.' + figformat, format=figformat, 
                bbox_inches='tight', dpi=300)
    
    return

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions