From ec3887eb939fba3a53c1610e4ce6a3b364ed5a38 Mon Sep 17 00:00:00 2001 From: "John R. Leeman" Date: Mon, 17 Feb 2020 08:26:03 -0600 Subject: [PATCH] Add fix for plotting with new pandas/matplotlib issue --- .../Pythonic Data Analysis.ipynb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pages/workshop/Pythonic_Data_Analysis/Pythonic Data Analysis.ipynb b/pages/workshop/Pythonic_Data_Analysis/Pythonic Data Analysis.ipynb index a375edbe..8d676b75 100644 --- a/pages/workshop/Pythonic_Data_Analysis/Pythonic Data Analysis.ipynb +++ b/pages/workshop/Pythonic_Data_Analysis/Pythonic Data Analysis.ipynb @@ -103,7 +103,7 @@ "fig, (ax1, ax2) = plt.subplots(1, 2, sharex=True, figsize=(18, 6))\n", "\n", "# Panel 1\n", - "ax1.plot(df.time, df.wind_speed, color='tab:orange', label='Windspeed')\n", + "ax1.plot(df.time.values, df.wind_speed, color='tab:orange', label='Windspeed')\n", "ax1.set_xlabel('Time')\n", "ax1.set_ylabel('Speed')\n", "ax1.set_title('Measured Winds')\n", @@ -115,7 +115,7 @@ "ax1.xaxis.set_major_locator(DayLocator())\n", "\n", "# Panel 2\n", - "ax2.plot(df.time, df.pressure, color='black', label='Pressure')\n", + "ax2.plot(df.time.values, df.pressure, color='black', label='Pressure')\n", "ax2.set_xlabel('Time')\n", "ax2.set_ylabel('hPa')\n", "ax2.set_title('Atmospheric Pressure')\n", @@ -587,7 +587,7 @@ "# Loop over the list of subplots and names together\n", "for ax, var_name in zip(axes, plot_variables):\n", " \n", - " ax.plot(df.time, df[var_name])\n", + " ax.plot(df.time.values, df[var_name])\n", "\n", " # Set label/title based on variable name--no longer hard-coded\n", " ax.set_ylabel(var_name)\n", @@ -653,7 +653,7 @@ "\n", " # Grab the color from our dictionary and pass it to plot()\n", " color = colors[var_name]\n", - " ax.plot(df.time, df[var_name], color)\n", + " ax.plot(df.time.values, df[var_name], color)\n", "\n", " ax.set_ylabel(var_name)\n", " ax.set_title(f'Buoy {var_name}')\n", @@ -686,7 +686,7 @@ " for var_name in var_names:\n", " # Grab the color from our dictionary and pass it to plot()\n", " color = colors[var_name]\n", - " ax.plot(df.time, df[var_name], color)\n", + " ax.plot(df.time.values, df[var_name], color)\n", "\n", " ax.set_ylabel(var_name)\n", " ax.set_title(f'Buoy {var_name}')\n", @@ -725,7 +725,7 @@ " for var_name in var_names:\n", " # Grab the color from our dictionary and pass it to plot()\n", " color = colors[var_name]\n", - " ax.plot(df.time, df[var_name], color)\n", + " ax.plot(df.time.values, df[var_name], color)\n", "\n", " ax.set_ylabel(var_name)\n", " ax.set_title(f'Buoy {var_name}')\n", @@ -791,7 +791,7 @@ " \n", " color = colors[var_name]\n", " linestyle = linestyles[var_name]\n", - " ax.plot(df.time, df[var_name], color, linestyle=linestyle, label=label)\n", + " ax.plot(df.time.values, df[var_name], color, linestyle=linestyle, label=label)\n", "\n", " ax.set_ylabel(title)\n", " ax.set_title(f'Buoy {title}')\n", @@ -840,7 +840,7 @@ " title, label = format_varname(var_name)\n", " color = colors[var_name]\n", " linestyle = linestyles[var_name]\n", - " ax.plot(df.time, df[var_name], color, linestyle=linestyle, label=label)\n", + " ax.plot(df.time.values, df[var_name], color, linestyle=linestyle, label=label)\n", "\n", " ax.set_ylabel(title)\n", " ax.set_title(f'Buoy {buoy} {title}')\n",