diff --git a/vayu/scatterPlot.py b/vayu/scatterPlot.py index 7cd2390..229214f 100644 --- a/vayu/scatterPlot.py +++ b/vayu/scatterPlot.py @@ -19,48 +19,28 @@ def scatterPlot(df, x, y, **kwargs): import matplotlib.cm as cm from math import pi - pm10 = df.pm10 - o3 = df.o3 - ws = df.ws - wd = df.wd - nox = df.nox - no2 = df.no2 - + ######################################### # converts wind data to randians - df = pd.DataFrame({"speed": ws, "direction": wd}) - df["speed_x"] = df["speed"] * np.sin(df["direction"] * pi / 180.0) - df["speed_y"] = df["speed"] * np.cos(df["direction"] * pi / 180.0) + #df1 = pd.DataFrame({"speed": ws, "direction": wd}) + df["speed"+str(x)] = df['ws'] * np.sin(df['wd'] * pi / 180.0) + df["speed"+str(y)] = df['ws'] * np.cos(df['wd'] * pi / 180.0) fig, ax = plt.subplots(figsize=(8, 8), dpi=80) x0, x1 = ax.get_xlim() y0, y1 = ax.get_ylim() - ax.set_aspect("equal") - _ = df.plot(kind="scatter", x="speed_x", y="speed_y", alpha=0.35, ax=ax) + #ax.set_aspect("equal") + _ = df.plot(kind="scatter", x="speed"+str(x), y="speed"+str(y), alpha=0.35, ax=ax) + plt.show() + #################################### # simple seaborn plot that shows how given variables relate with one another - if x == "nox": - x = nox - elif x == "no2": - x = no2 - elif x == "o3": - x = o3 - elif x == "pm10": - x = pm10 - if y == "nox": - y = nox - elif y == "no2": - y = no2 - elif y == "o3": - y = o3 - elif y == "pm10": - y = pm10 - - sns.jointplot(x=x, y=y, kind="hex") - + sns.jointplot(x=df[x].values, y=df[y].values, kind="hex") + plt.xlabel(x) + plt.ylabel(y) plt.show() - - + + # ============================================================================= # df = pd.read_csv("mydata.csv") # scatterPlot(df,'nox','no2')