Skip to content

Commit 19f7cf2

Browse files
authored
Merge pull request #77 from jrleeman/pythonic_update
Add fix for plotting with new pandas/matplotlib issue
2 parents 0011bdf + ec3887e commit 19f7cf2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pages/workshop/Pythonic_Data_Analysis/Pythonic Data Analysis.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"fig, (ax1, ax2) = plt.subplots(1, 2, sharex=True, figsize=(18, 6))\n",
104104
"\n",
105105
"# Panel 1\n",
106-
"ax1.plot(df.time, df.wind_speed, color='tab:orange', label='Windspeed')\n",
106+
"ax1.plot(df.time.values, df.wind_speed, color='tab:orange', label='Windspeed')\n",
107107
"ax1.set_xlabel('Time')\n",
108108
"ax1.set_ylabel('Speed')\n",
109109
"ax1.set_title('Measured Winds')\n",
@@ -115,7 +115,7 @@
115115
"ax1.xaxis.set_major_locator(DayLocator())\n",
116116
"\n",
117117
"# Panel 2\n",
118-
"ax2.plot(df.time, df.pressure, color='black', label='Pressure')\n",
118+
"ax2.plot(df.time.values, df.pressure, color='black', label='Pressure')\n",
119119
"ax2.set_xlabel('Time')\n",
120120
"ax2.set_ylabel('hPa')\n",
121121
"ax2.set_title('Atmospheric Pressure')\n",
@@ -587,7 +587,7 @@
587587
"# Loop over the list of subplots and names together\n",
588588
"for ax, var_name in zip(axes, plot_variables):\n",
589589
" \n",
590-
" ax.plot(df.time, df[var_name])\n",
590+
" ax.plot(df.time.values, df[var_name])\n",
591591
"\n",
592592
" # Set label/title based on variable name--no longer hard-coded\n",
593593
" ax.set_ylabel(var_name)\n",
@@ -653,7 +653,7 @@
653653
"\n",
654654
" # Grab the color from our dictionary and pass it to plot()\n",
655655
" color = colors[var_name]\n",
656-
" ax.plot(df.time, df[var_name], color)\n",
656+
" ax.plot(df.time.values, df[var_name], color)\n",
657657
"\n",
658658
" ax.set_ylabel(var_name)\n",
659659
" ax.set_title(f'Buoy {var_name}')\n",
@@ -686,7 +686,7 @@
686686
" for var_name in var_names:\n",
687687
" # Grab the color from our dictionary and pass it to plot()\n",
688688
" color = colors[var_name]\n",
689-
" ax.plot(df.time, df[var_name], color)\n",
689+
" ax.plot(df.time.values, df[var_name], color)\n",
690690
"\n",
691691
" ax.set_ylabel(var_name)\n",
692692
" ax.set_title(f'Buoy {var_name}')\n",
@@ -725,7 +725,7 @@
725725
" for var_name in var_names:\n",
726726
" # Grab the color from our dictionary and pass it to plot()\n",
727727
" color = colors[var_name]\n",
728-
" ax.plot(df.time, df[var_name], color)\n",
728+
" ax.plot(df.time.values, df[var_name], color)\n",
729729
"\n",
730730
" ax.set_ylabel(var_name)\n",
731731
" ax.set_title(f'Buoy {var_name}')\n",
@@ -791,7 +791,7 @@
791791
" \n",
792792
" color = colors[var_name]\n",
793793
" linestyle = linestyles[var_name]\n",
794-
" ax.plot(df.time, df[var_name], color, linestyle=linestyle, label=label)\n",
794+
" ax.plot(df.time.values, df[var_name], color, linestyle=linestyle, label=label)\n",
795795
"\n",
796796
" ax.set_ylabel(title)\n",
797797
" ax.set_title(f'Buoy {title}')\n",
@@ -840,7 +840,7 @@
840840
" title, label = format_varname(var_name)\n",
841841
" color = colors[var_name]\n",
842842
" linestyle = linestyles[var_name]\n",
843-
" ax.plot(df.time, df[var_name], color, linestyle=linestyle, label=label)\n",
843+
" ax.plot(df.time.values, df[var_name], color, linestyle=linestyle, label=label)\n",
844844
"\n",
845845
" ax.set_ylabel(title)\n",
846846
" ax.set_title(f'Buoy {buoy} {title}')\n",

0 commit comments

Comments
 (0)