forked from plotly/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'source' into new-design-2016
# Conflicts: # _includes/documentation_eg.html # _includes/head.html # _includes/lang-splash-banner.html # _includes/side-bar.html # _layouts/base.html # _layouts/langindex.html # _posts/ggplot2/Aesthetics/2016-01-27-aes_index.html # _posts/ggplot2/Faceting/facet_grid/2015-04-09-facets_ggplot2_index.html # _posts/ggplot2/Faceting/facet_wrap/2015-07-14-facet_wrap_index.html # _posts/ggplot2/Theme/axis.text/2016-01-27-Themes_axistext_index.html # _posts/ggplot2/Theme/axis.ticks/2016-01-27-Themes_axisticks_index.html # _posts/ggplot2/Theme/axis.title/2016-01-27-Themes_axistitles_index.html # _posts/ggplot2/time-series/2015-07-14-time-series_ggplot2_index.html # _posts/ggplot2/yscale/2015-07-20-log_scale_index.html # _posts/matlab/backgrounds/2016-02-17-backgrounds_matlab_index.html # _posts/matlab/labels/2015-04-15-matlab-setting-title.html # _posts/matlab/quiver-plots/2016-02-28-matlab-quiver-plot-with-points.htm l # _posts/matlab/quiver-plots/2016-02-28-quiver-plot.html # _posts/matlab/quiver-plots/2016-02-28-quiver_matlab_index.html # _posts/matplotlib/backgrounds/2016-02-12-backgrounds_matplotlib_index.ht ml # _posts/matplotlib/box/2016-02-08-box_matplotlib_index.html # _posts/matplotlib/error-bar/2016-02-08-error-bar_matplotlib_index.html # _posts/matplotlib/heatmap/2016-02-08-heatmap_matplotlib_index.html # _posts/matplotlib/labels/2015-04-15-mpl-setting-title-on-subplots.html # _posts/matplotlib/labels/2015-04-15-mpl-setting-title.html # _posts/matplotlib/labels/2016-02-15-labels_matplotlib_index.html # _posts/matplotlib/lines-and-markers/2016-02-08-lines-and-markers_matplot lib_index.html # _posts/matplotlib/quiver-plots/2016-02-22-mpl-quiver-plot-with-points.ht ml # _posts/matplotlib/quiver-plots/2016-02-22-quiver_matplotlib_index.html # _posts/matplotlib/static-image/2016-02-22-static-image_matplotlib_index. md # _posts/matplotlib/subplots/2016-02-11-mpl-subplot-variable-widths.html # _posts/matplotlib/time-series/2016-02-12-mpl-bsaic-time-series.html # _posts/matplotlib/time-series/2016-02-12-time-series_matplotlib_index.ht ml # _posts/plotly_js/continuous-error-bars/2016-02-15-continuous-error-bar_p lotly_js_index.html # _posts/plotly_js/continuous-error-bars/2016-02-15-continuous-variable.ht ml # _posts/plotly_js/continuous-error-bars/2016-02-15-filled-lines.html # _posts/plotly_js/trisurf/2016-02-29-trisurf-basic.html # _posts/plotly_js/trisurf/2016-02-29-trisurf_plotly_js_index.html # _posts/python/continuous-error-bars/2016-02-15-continuous-error-bar_pyth on_index.html # _posts/python/continuous-error-bars/2016-02-15-continuous-variable.html # _posts/python/continuous-error-bars/2016-02-15-filled-lines.html # _posts/user_guide_python/plotly_offline.ipynb
- Loading branch information
Showing
12 changed files
with
3,645 additions
and
5 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,4 +44,4 @@ | |
crossorigin="anonymous"></script> | ||
|
||
|
||
</head> | ||
</head> |
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
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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,8 +40,6 @@ | |
|
||
</main> | ||
|
||
|
||
|
||
{% include helpbox.html %} | ||
|
||
{% include _new/_page-components/_footer-main.html %} | ||
|
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
169 changes: 169 additions & 0 deletions
169
_posts/user_guide_python/2015-06-30-bar_chart_stream.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
--- | ||
permalink: python/bar_chart_stream/ | ||
description: Getting Started with Plotly Streaming | ||
title: Bar Chart Streaming Demo | ||
has_thumbnail: true | ||
thumbnail: | ||
has_thumbnail: false | ||
layout: user-guide | ||
page_type: u-guide | ||
language: python | ||
title: Bar Chart Streaming | ||
--- | ||
{% raw %} | ||
<div class="cell border-box-sizing text_cell rendered"> | ||
<div class="prompt input_prompt"> | ||
</div> | ||
<div class="inner_cell"> | ||
<div class="text_cell_render border-box-sizing rendered_html"> | ||
<h2 id="Streaming-Bar-Chart-Demo">Streaming Bar Chart Demo<a class="anchor-link" href="#Streaming-Bar-Chart-Demo">¶</a></h2> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="cell border-box-sizing code_cell rendered"> | ||
<div class="input"> | ||
<div class="prompt input_prompt">In [1]:</div> | ||
<div class="inner_cell"> | ||
<div class="input_area"> | ||
<div class=" highlight hl-ipython2"><pre><span class="kn">import</span> <span class="nn">plotly.plotly</span> <span class="kn">as</span> <span class="nn">py</span> | ||
<span class="kn">import</span> <span class="nn">plotly.tools</span> <span class="kn">as</span> <span class="nn">tls</span> | ||
<span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span> | ||
<span class="kn">import</span> <span class="nn">time</span> | ||
|
||
<span class="kn">from</span> <span class="nn">plotly.graph_objs</span> <span class="kn">import</span> <span class="o">*</span> | ||
|
||
<span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span> | ||
|
||
<span class="n">stream_id</span> <span class="o">=</span> <span class="s">'jkc6d90yfw'</span> | ||
|
||
<span class="c"># We can generate a new stream id object</span> | ||
<span class="n">stream</span> <span class="o">=</span> <span class="n">Stream</span><span class="p">(</span> | ||
<span class="n">token</span><span class="o">=</span><span class="n">stream_id</span><span class="p">,</span> | ||
<span class="n">maxpoints</span><span class="o">=</span><span class="mi">80</span> | ||
<span class="p">)</span> | ||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
<div class="cell border-box-sizing code_cell rendered"> | ||
<div class="input"> | ||
<div class="prompt input_prompt">In [2]:</div> | ||
<div class="inner_cell"> | ||
<div class="input_area"> | ||
<div class=" highlight hl-ipython2"><pre><span class="c">#A simple bar chart object is generated</span> | ||
|
||
<span class="n">trace1</span> <span class="o">=</span> <span class="n">Bar</span><span class="p">(</span> | ||
<span class="n">x</span><span class="o">=</span><span class="p">[</span><span class="s">'one'</span><span class="p">,</span><span class="s">'two'</span><span class="p">,</span><span class="s">'three'</span><span class="p">,</span><span class="s">'four'</span><span class="p">,</span><span class="s">'five'</span><span class="p">],</span> | ||
<span class="n">y</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">20</span><span class="p">,</span><span class="mi">20</span><span class="p">,</span><span class="mi">20</span><span class="p">,</span><span class="mi">20</span><span class="p">,</span><span class="mi">20</span><span class="p">]),</span> | ||
<span class="n">stream</span><span class="o">=</span><span class="n">stream</span> <span class="c">#we set the stream parameter to the stream id object created earlier </span> | ||
<span class="p">)</span> | ||
|
||
<span class="n">data</span> <span class="o">=</span> <span class="n">Data</span><span class="p">([</span><span class="n">trace1</span><span class="p">])</span> | ||
<span class="n">layout</span> <span class="o">=</span> <span class="n">Layout</span><span class="p">(</span><span class="n">title</span><span class="o">=</span><span class="s">'Bar Chart Streaming'</span><span class="p">)</span> | ||
<span class="n">fig</span> <span class="o">=</span> <span class="n">Figure</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span> <span class="n">layout</span><span class="o">=</span><span class="n">layout</span><span class="p">)</span> | ||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
<div class="cell border-box-sizing code_cell rendered"> | ||
<div class="input"> | ||
<div class="prompt input_prompt">In [ ]:</div> | ||
<div class="inner_cell"> | ||
<div class="input_area"> | ||
<div class=" highlight hl-ipython2"><pre><span class="n">py</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">fig</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="s">'bar-chart'</span><span class="p">)</span> <span class="c">#post this plot up onto the plotly servers</span> | ||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
<div class="cell border-box-sizing code_cell rendered"> | ||
<div class="input"> | ||
<div class="prompt input_prompt">In [13]:</div> | ||
<div class="inner_cell"> | ||
<div class="input_area"> | ||
<div class=" highlight hl-ipython2"><pre><span class="c">#Now a Stream object is created w/ the same stream_id as the stream id object</span> | ||
|
||
<span class="n">s</span> <span class="o">=</span> <span class="n">py</span><span class="o">.</span><span class="n">Stream</span><span class="p">(</span><span class="n">stream_id</span><span class="p">)</span> | ||
<span class="n">s</span><span class="o">.</span><span class="n">open</span><span class="p">()</span> | ||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
<div class="cell border-box-sizing code_cell rendered"> | ||
<div class="input"> | ||
<div class="prompt input_prompt">In [ ]:</div> | ||
<div class="inner_cell"> | ||
<div class="input_area"> | ||
<div class=" highlight hl-ipython2"><pre><span class="k">while</span> <span class="bp">True</span><span class="p">:</span> | ||
|
||
<span class="n">s</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="nb">dict</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="p">[</span><span class="s">'one'</span><span class="p">,</span><span class="s">'two'</span><span class="p">,</span><span class="s">'three'</span><span class="p">,</span><span class="s">'four'</span><span class="p">,</span><span class="s">'five'</span><span class="p">],</span> <span class="n">y</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">random_integers</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">100</span><span class="p">,</span><span class="mi">5</span><span class="p">)))</span> | ||
|
||
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.2</span><span class="p">)</span> <span class="c">#wait one second before plotting again</span> | ||
|
||
<span class="n">s</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> <span class="c">#close the stream</span> | ||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
<div class="cell border-box-sizing code_cell rendered"> | ||
<div class="input"> | ||
<div class="prompt input_prompt">In [6]:</div> | ||
<div class="inner_cell"> | ||
<div class="input_area"> | ||
<div class=" highlight hl-ipython2"><pre><span class="n">tls</span><span class="o">.</span><span class="n">embed</span><span class="p">(</span><span class="s">'https://plot.ly/~streaming-demos/116/bar-chart-streaming'</span><span class="p">)</span> | ||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="output_wrapper"> | ||
<div class="output"> | ||
|
||
|
||
<div class="output_area"><div class="prompt output_prompt">Out[6]:</div> | ||
|
||
<div class="output_html rendered_html output_subarea output_execute_result"> | ||
<iframe id="igraph" scrolling="no" style="border:none;" seamless="seamless" src="https://plot.ly/~streaming-demos/116.embed" height="525" width="100%"></iframe> | ||
</div> | ||
|
||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
</div> | ||
<div class="cell border-box-sizing text_cell rendered"> | ||
<div class="prompt input_prompt"> | ||
</div> | ||
<div class="inner_cell"> | ||
<div class="text_cell_render border-box-sizing rendered_html"> | ||
<div style="float:right; \"> | ||
<img src="http://i.imgur.com/4vwuxdJ.png" | ||
align=right style="float:right; margin-left: 5px; margin-top: -10px" /> | ||
</div> | ||
|
||
<h4>Got Questions or Feedback? </h4> | ||
|
||
<p>Reach us here at: <a href="https://community.plot.ly" target="_blank">Plotly Community</a></p> | ||
<p><h4> What's going on at Plotly? </h4> | ||
Check out our twitter: | ||
<a href="https://twitter.com/plotlygraphs" target="_blank">@plotlygraphs</a></p> | ||
|
||
</div> | ||
</div> | ||
</div>{% endraw %} |
Oops, something went wrong.