Skip to content

Commit 04b8697

Browse files
committed
added back sotus example
1 parent c13c399 commit 04b8697

File tree

11 files changed

+190
-0
lines changed

11 files changed

+190
-0
lines changed
1.57 KB
Binary file not shown.
661 Bytes
Binary file not shown.
53 KB
Loading
26.6 KB
Loading

docs/auto_examples/index.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,26 @@ Gallery of Examples
77

88

99

10+
.. raw:: html
11+
12+
<div class="sphx-glr-thumbcontainer" tooltip="To plot text, simply pass the text data to the plot function. Here, we are ploting each SOTU a...">
13+
14+
.. only:: html
15+
16+
.. figure:: /auto_examples/images/thumb/sphx_glr_plot_sotus_thumb.png
17+
18+
:ref:`sphx_glr_auto_examples_plot_sotus.py`
19+
20+
.. raw:: html
21+
22+
</div>
23+
24+
25+
.. toctree::
26+
:hidden:
27+
28+
/auto_examples/plot_sotus
29+
1030
.. raw:: html
1131

1232
<div class="sphx-glr-thumbcontainer" tooltip="Here is a basic example where we load in some data (a list of arrays - samples by features), ta...">
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"nbformat_minor": 0,
3+
"nbformat": 4,
4+
"cells": [
5+
{
6+
"execution_count": null,
7+
"cell_type": "code",
8+
"source": [
9+
"%matplotlib inline"
10+
],
11+
"outputs": [],
12+
"metadata": {
13+
"collapsed": false
14+
}
15+
},
16+
{
17+
"source": [
18+
"\n# Plotting State of the Union Addresses from 1989-2017\n\n\nTo plot text, simply pass the text data to the plot function. Here, we are\nploting each SOTU address fit to a topic model, and then reduced to visualize.\nBy default, hypertools transforms the text data using a model fit to a selected\nset of wikipedia pages.\n\n\n"
19+
],
20+
"cell_type": "markdown",
21+
"metadata": {}
22+
},
23+
{
24+
"execution_count": null,
25+
"cell_type": "code",
26+
"source": [
27+
"# Code source: Andrew Heusser\n# License: MIT\n\n# load hypertools\nimport hypertools as hyp\n\n# load the data\ngeo = hyp.load('sotus')\n\n# plot it\ngeo.plot()"
28+
],
29+
"outputs": [],
30+
"metadata": {
31+
"collapsed": false
32+
}
33+
}
34+
],
35+
"metadata": {
36+
"kernelspec": {
37+
"display_name": "Python 2",
38+
"name": "python2",
39+
"language": "python"
40+
},
41+
"language_info": {
42+
"mimetype": "text/x-python",
43+
"nbconvert_exporter": "python",
44+
"name": "python",
45+
"file_extension": ".py",
46+
"version": "2.7.11",
47+
"pygments_lexer": "ipython2",
48+
"codemirror_mode": {
49+
"version": 2,
50+
"name": "ipython"
51+
}
52+
}
53+
}
54+
}

docs/auto_examples/plot_sotus.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
=============================
4+
Plotting State of the Union Addresses from 1989-2017
5+
=============================
6+
7+
To plot text, simply pass the text data to the plot function. Here, we are
8+
ploting each SOTU address fit to a topic model, and then reduced to visualize.
9+
By default, hypertools transforms the text data using a model fit to a selected
10+
set of wikipedia pages.
11+
12+
"""
13+
14+
# Code source: Andrew Heusser
15+
# License: MIT
16+
17+
# load hypertools
18+
import hypertools as hyp
19+
20+
# load the data
21+
geo = hyp.load('sotus')
22+
23+
# plot it
24+
geo.plot()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
28384fe763ffb88bed061ab872c728fb

docs/auto_examples/plot_sotus.rst

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
2+
3+
.. _sphx_glr_auto_examples_plot_sotus.py:
4+
5+
6+
=============================
7+
Plotting State of the Union Addresses from 1989-2017
8+
=============================
9+
10+
To plot text, simply pass the text data to the plot function. Here, we are
11+
ploting each SOTU address fit to a topic model, and then reduced to visualize.
12+
By default, hypertools transforms the text data using a model fit to a selected
13+
set of wikipedia pages.
14+
15+
16+
17+
18+
19+
.. image:: /auto_examples/images/sphx_glr_plot_sotus_001.png
20+
:align: center
21+
22+
23+
24+
25+
26+
.. code-block:: python
27+
28+
29+
# Code source: Andrew Heusser
30+
# License: MIT
31+
32+
# load hypertools
33+
import hypertools as hyp
34+
35+
# load the data
36+
geo = hyp.load('sotus')
37+
38+
# plot it
39+
geo.plot()
40+
41+
**Total running time of the script:** ( 0 minutes 0.193 seconds)
42+
43+
44+
45+
.. only :: html
46+
47+
.. container:: sphx-glr-footer
48+
49+
50+
.. container:: sphx-glr-download
51+
52+
:download:`Download Python source code: plot_sotus.py <plot_sotus.py>`
53+
54+
55+
56+
.. container:: sphx-glr-download
57+
58+
:download:`Download Jupyter notebook: plot_sotus.ipynb <plot_sotus.ipynb>`
59+
60+
61+
.. only:: html
62+
63+
.. rst-class:: sphx-glr-signature
64+
65+
`Gallery generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
�}qUhyp.load}q(U module_shortqU
2+
hypertoolsqUnameqUloadUmoduleqhus.

0 commit comments

Comments
 (0)