Skip to content

Commit

Permalink
Terra is removing deprecated interactive visualizations (Qiskit#1142)
Browse files Browse the repository at this point in the history
* move iplot to plot

* remove the cells explaining the iplots

(cherry picked from commit 60fd593)
  • Loading branch information
1ucian0 authored and mtreinish committed Apr 5, 2021
1 parent a0fcb28 commit f9940ff
Showing 1 changed file with 0 additions and 80 deletions.
80 changes: 0 additions & 80 deletions tutorials/circuits/2_plotting_data_in_qiskit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -565,86 +565,6 @@
"When using any of the state plotting functions it returns a `matplotlib.Figure` for the rendered visualization. Jupyter notebooks understand this return type and render it for us in this tutorial, but when running outside of Jupyter you do not have this feature automatically. However, the `matplotlib.Figure` class natively has methods to both display and save the visualization. You can call `.show()` on the returned object to open the image in a new window (assuming your configured matplotlib backend is interactive). Or alternatively you can call `.savefig('out.png')` to save the figure to `out.png` in the current working directory. The `savefig()` method takes a path so you can adjust the location and filename where you're saving the output."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Interactive State Plots for Jupyter Notebooks <a name='interstate'></a>\n",
"\n",
"Just like with `plot_histogram()` there is a second set of functions for each of the functions to plot the quantum state. These functions have the same name but with a prepended `i`:\n",
"\n",
"```\n",
"iplot_state_city(quantum_state)\n",
"iplot_state_paulivec(quantum_state)\n",
"iplot_state_qsphere(quantum_state)\n",
"iplot_state_hinton(quantum_state)\n",
"iplot_bloch_multivector(quantum_state)\n",
"```\n",
"\n",
"These functions are made using an externally hosted JS library for use in Jupyter notebooks. The interactive plot can only be used if you're running inside a Jupyter notebook and only if you have external connectivity to the host with the JS library. If you use these functions outside of a Jupyter notebook it will fail."
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"ExecuteTime": {
"end_time": "2019-08-09T13:24:25.605692Z",
"start_time": "2019-08-09T13:24:25.602764Z"
}
},
"outputs": [],
"source": [
"from qiskit.tools.visualization import iplot_state_paulivec"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"ExecuteTime": {
"end_time": "2019-08-09T13:24:25.840992Z",
"start_time": "2019-08-09T13:24:25.820959Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <p>\n",
" <div id=\"paulivec_1588038401085831\"></div>\n",
" </p>\n",
" \n",
" <script>\n",
" requirejs.config({\n",
" paths: {\n",
" qVisualization: \"https://qvisualization.mybluemix.net/q-visualizations\"\n",
" }\n",
" });\n",
"\n",
" require([\"qVisualization\"], function(qVisualizations) {\n",
" qVisualizations.plotState(\"paulivec_1588038401085831\",\n",
" \"paulivec\",\n",
" [{'data': {'II': 1.0, 'IX': 0.0, 'IY': 0.0, 'IZ': 2.220446049250313e-16, 'XI': 0.0, 'YI': 0.0, 'ZI': 2.220446049250313e-16, 'XX': 1.0, 'XY': 0.0, 'XZ': 0.0, 'YX': 0.0, 'YY': -1.0, 'YZ': 0.0, 'ZX': 0.0, 'ZY': 0.0, 'ZZ': 1.0}}],\n",
" {'width': 7, 'height': 5, 'slider': 0, 'show_legend': 0});\n",
" });\n",
" </script>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Generate an interactive pauli vector plot\n",
"iplot_state_paulivec(psi)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down

0 comments on commit f9940ff

Please sign in to comment.