#!/usr/bin/env python # coding: utf-8 # # Example notebook for hosting on mybinder.org # June 15, 2020 7:53 PM EST # On Github datasciY repo. # # ### MyBinder build environment # to add mybinder badge # # environment.yml has to be at root level. # Re-built image, launch takes very long time. # \- # In[1]: # Add Opin in Binder badge. # ### Google Colab link - Done # Used html table to make into a box. # To add black outline around table somehow. # # #
# Run in Google Colab #
# # Run in Google Colab # # # Open In Colab Open in Colab # # # Open In Colab # # In[1]: import numpy as np import matplotlib.pyplot as plt from mpl_toolkits import mplot3d get_ipython().run_line_magic('matplotlib', 'inline') # ### 1. Matplotlib 3D plots # In[2]: # 3D data def f(x, y): return np.cos(np.sqrt(x**2 + y**2)) x = np.linspace(-4, 4, 36) y = np.linspace(-4, 4, 36) X, Y = np.meshgrid(x, y) Z = f(X, Y) # In[3]: # OO Style, set plot fig = plt.figure() ax = plt.axes(projection='3d') ax.contour3D(X, Y, Z, 60, cmap='RdBu') ax.set(xlabel='X', ylabel='Y', zlabel='Z', title='Contour Plot 3D') # ### 2. Overploting Histograms # In[4]: # data for 3 histograms, randomly generated x1 = np.random.normal(0, 0.5, 200) x2 = np.random.normal(-2, 1, 200) x3 = np.random.normal(3, 1.6, 200) # In[5]: plt.style.use('seaborn-whitegrid') kwargs = dict(histtype='stepfilled', alpha=0.4, density=True, bins=25) plt.hist(x1, **kwargs) plt.hist(x2, **kwargs) plt.hist(x3, **kwargs) plt.title('Three Histograms') plt.xlabel('X data') plt.ylabel('Y count'); # In[6]: get_ipython().system('python --version') import datetime as dt print(dt.date.today()) print(dt.datetime.now()) # In[ ]: