prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Make interactive visualizations default for Jupyter
  <!-- ⚠️ If you do not respect this template, your issue will be closed -->
  <!-- ⚠️ Make sure to browse the opened and closed issues to confirm this idea does not exist. -->
  
  ### What is the expected enhancement?
  The interactive visualizations contributed in PR #765 are much better than the static ones, and should be default when the environment is a Jupyter notebook. This is related to Epic #707 for providing better jupyter tools.
  
  Several issues must be solved first:
  - These visualizations need internet connection. Can we eliminate that?
  - The interface of the static and interactive visualizations are all the same, except for `plot_histogram` vs `iplot_histogram`. These should be made similar for consistency. But the interactive visualization is able to plot multiple histograms in one plot.
  - How "heavy" is it to run these interactive visualizations? I hear my laptop fan.
  
  </issue>
  <code>
  [start of qiskit/tools/visualization/__init__.py]
  1 # -*- coding: utf-8 -*-
  2 
  3 # Copyright 2018, IBM.
  4 #
  5 # This source code is licensed under the Apache License, Version 2.0 found in
  6 # the LICENSE.txt file in the root directory of this source tree.
  7 
  8 """Main QISKit visualization methods."""
  9 
  10 from ._circuit_visualization import circuit_drawer, plot_circuit, generate_latex_source,\
  11     latex_circuit_drawer, matplotlib_circuit_drawer, qx_color_scheme
  12 from ._state_visualization import plot_state
  13 from ._counts_visualization import plot_histogram
  14
  [end of qiskit/tools/visualization/__init__.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/qiskit/tools/visualization/__init__.py b/qiskit/tools/visualization/__init__.py
  --- a/qiskit/tools/visualization/__init__.py
  +++ b/qiskit/tools/visualization/__init__.py
  @@ -7,7 +7,18 @@
   
   """Main QISKit visualization methods."""
   
  +import sys
  +
   from ._circuit_visualization import circuit_drawer, plot_circuit, generate_latex_source,\
       latex_circuit_drawer, matplotlib_circuit_drawer, qx_color_scheme
  -from ._state_visualization import plot_state
   from ._counts_visualization import plot_histogram
  +
  +if ('ipykernel' in sys.modules) and ('spyder' not in sys.modules):
  +    import requests
  +    if requests.get(
  +            'https://qvisualization.mybluemix.net/').status_code == 200:
  +        from .interactive._iplot_state import iplot_state as plot_state
  +    else:
  +        from ._state_visualization import plot_state
  +else:
  +    from ._state_visualization import plot_state
  
verification_info: {"golden_diff": "diff --git a/qiskit/tools/visualization/__init__.py b/qiskit/tools/visualization/__init__.py\n--- a/qiskit/tools/visualization/__init__.py\n+++ b/qiskit/tools/visualization/__init__.py\n@@ -7,7 +7,18 @@\n \n \"\"\"Main QISKit visualization methods.\"\"\"\n \n+import sys\n+\n from ._circuit_visualization import circuit_drawer, plot_circuit, generate_latex_source,\\\n     latex_circuit_drawer, matplotlib_circuit_drawer, qx_color_scheme\n-from ._state_visualization import plot_state\n from ._counts_visualization import plot_histogram\n+\n+if ('ipykernel' in sys.modules) and ('spyder' not in sys.modules):\n+    import requests\n+    if requests.get(\n+            'https://qvisualization.mybluemix.net/').status_code == 200:\n+        from .interactive._iplot_state import iplot_state as plot_state\n+    else:\n+        from ._state_visualization import plot_state\n+else:\n+    from ._state_visualization import plot_state\n", "issue": "Make interactive visualizations default for Jupyter\n<!-- \u26a0\ufe0f If you do not respect this template, your issue will be closed -->\r\n<!-- \u26a0\ufe0f Make sure to browse the opened and closed issues to confirm this idea does not exist. -->\r\n\r\n### What is the expected enhancement?\r\nThe interactive visualizations contributed in PR #765 are much better than the static ones, and should be default when the environment is a Jupyter notebook. This is related to Epic #707 for providing better jupyter tools.\r\n\r\nSeveral issues must be solved first:\r\n- These visualizations need internet connection. Can we eliminate that?\r\n- The interface of the static and interactive visualizations are all the same, except for `plot_histogram` vs `iplot_histogram`. These should be made similar for consistency. But the interactive visualization is able to plot multiple histograms in one plot.\r\n- How \"heavy\" is it to run these interactive visualizations? I hear my laptop fan.\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n# Copyright 2018, IBM.\n#\n# This source code is licensed under the Apache License, Version 2.0 found in\n# the LICENSE.txt file in the root directory of this source tree.\n\n\"\"\"Main QISKit visualization methods.\"\"\"\n\nfrom ._circuit_visualization import circuit_drawer, plot_circuit, generate_latex_source,\\\n    latex_circuit_drawer, matplotlib_circuit_drawer, qx_color_scheme\nfrom ._state_visualization import plot_state\nfrom ._counts_visualization import plot_histogram\n", "path": "qiskit/tools/visualization/__init__.py"}]}