Skip to content

Instantly share code, notes, and snippets.

@GeorgeSeif
Last active August 7, 2019 18:03
Show Gist options
  • Save GeorgeSeif/5f1b2d650ce95efcc69d1fae77f0deca to your computer and use it in GitHub Desktop.
Save GeorgeSeif/5f1b2d650ce95efcc69d1fae77f0deca to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
import numpy as np
def scatterplot(x_data, y_data, x_label="", y_label="", title="", color = "r", yscale_log=False):
# Create the plot object
_, ax = plt.subplots()
# Plot the data, set the size (s), color and transparency (alpha)
# of the points
ax.scatter(x_data, y_data, s = 10, color = color, alpha = 0.75)
if yscale_log == True:
ax.set_yscale('log')
# Label the axes and provide a title
ax.set_title(title)
ax.set_xlabel(x_label)
ax.set_ylabel(y_label)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment