Last active
March 22, 2019 21:42
-
-
Save kmader/7a182744194a5330008b6e40d60aea6b to your computer and use it in GitHub Desktop.
Out of order bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: plotly_express | |
dependencies: | |
- python=3.5 | |
- numpy | |
- matplotlib | |
- pandas | |
- scikit-learn | |
- pip: | |
- plotly==3.7.1 | |
- plotly_express |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"source": [ | |
"import plotly_express as px\n", | |
"import plotly\n", | |
"import pandas as pd\n", | |
"print(plotly.__version__, pd.__version__)" | |
], | |
"outputs": [], | |
"execution_count": null, | |
"metadata": { | |
"_uuid": "107552f24aeabd6ed8cd0e09a2bed134d7e4e3e0" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"%matplotlib inline\n", | |
"from sklearn.datasets import make_blobs, make_moons, make_swiss_roll\n", | |
"import matplotlib.pyplot as plt\n", | |
"import numpy as np\n", | |
"import pandas as pd\n", | |
"from string import ascii_lowercase\n", | |
"out_pt_list = []\n", | |
"for frame, std in enumerate(np.linspace(0.1, 2, 50)):\n", | |
" blob_data = make_blobs(n_samples=100, \n", | |
" cluster_std=std,\n", | |
" centers=4,\n", | |
" random_state=2019)\n", | |
" test_pts = pd.DataFrame(blob_data[0], columns=['x', 'y'])\n", | |
" test_pts['group'] = [ascii_lowercase[x] for x in blob_data[1]]\n", | |
" test_pts['frame'] = frame\n", | |
" out_pt_list += [test_pts]\n", | |
"out_pt_df = pd.concat(out_pt_list, sort=False).reset_index(drop=True)\n", | |
"out_pt_df.sample(5)" | |
], | |
"outputs": [], | |
"execution_count": null, | |
"metadata": { | |
"_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19", | |
"_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"px.scatter(out_pt_df, \n", | |
" x='x', y='y', \n", | |
" animation_frame='frame', \n", | |
" color='group')" | |
], | |
"outputs": [], | |
"execution_count": null, | |
"metadata": { | |
"_uuid": "64b339e21985a7079be7befe990721a567fd6836" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [], | |
"outputs": [], | |
"execution_count": null, | |
"metadata": { | |
"_uuid": "de21ac44e703e4f5f2d97e9e4796e85c40120021" | |
} | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"name": "python3", | |
"language": "python", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python", | |
"version": "3.6.5", | |
"mimetype": "text/x-python", | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"pygments_lexer": "ipython3", | |
"nbconvert_exporter": "python", | |
"file_extension": ".py" | |
}, | |
"kernel_info": { | |
"name": "python3" | |
}, | |
"nteract": { | |
"version": "0.12.3" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to run the notebook use mybinder at https://mybinder.org/v2/gist/kmader/7a182744194a5330008b6e40d60aea6b/master?filepath=example.ipynb