Skip to content

Instantly share code, notes, and snippets.

@kperry2215
Created July 15, 2019 00:05
Show Gist options
  • Save kperry2215/f3821b9b774bf99e0e803200a2b9fc6f to your computer and use it in GitHub Desktop.
Save kperry2215/f3821b9b774bf99e0e803200a2b9fc6f to your computer and use it in GitHub Desktop.
def generate_plot(df, x_variable, y_variables, plot_title):
"""
This function is used to map x- and y-variables against each other
Arguments:
df: Pandas dataframe.
x_variable: String. Name of the column that we want to set as the
x-variable in the plot
y_variables: string (single), or list of strings (multiple). Name(s)
of the column(s) that we want to set as the y-variable in the plot
Outputs:
Scatter plot in console.
"""
#Plot results
df.plot(x=x_variable, y=y_variables, title=plot_title)
plt.show()
"""
Main script execution here
"""
generate_plot(dataframe, x_variable='JobStartDate',
y_variables=['TotalBaseWaterVolume'],
plot_title='Total Base Water Volume for Fracs over Time')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment