A Plotly is a Python library that is used to design graphs, especially interactive graphs. It can plot various graphs and charts like histogram, barplot, boxplot, spreadplot, and many more. It is mainly used in data analysis as well as financial analysis. plotly is an interactive visualization library.

## Streamline Plots in Plotly

In plotly, streamline plots are based on the representation on a 2-D vector field which is explained as velocity fields, which are consist of closed curves that are tangent to the velocity field. Streamlining is the fastest technique and more efficient for getting the data. Velocity values are interpolated when determining the streamlines. Streamlines are initialized on the boundary of the x-y domain.

Syntax:create_streamline(x, y, u, v, density=1, angle=0.3490658503988659, arrow_scale=0.09)

Parameters:

x:1 dimensional, evenly spaced list or array

y:1 dimensional, evenly spaced list or array

u:2 dimensional array

v:2 dimensional array

density:controls the density of streamlines in plot. This is multiplied by 30 to scale similiarly to other available streamline functions such as matplotlib. Default = 1

angle:angle of arrowhead. Default = pi/9

arrow_scale:value to scale length of arrowhead Default = .09

**Example:**

## Python3

`import` `plotly.figure_factory as ff ` `import` `numpy as np ` ` ` `x ` `=` `np.linspace(` `-` `1` `, ` `1` `, ` `10` `) ` `y ` `=` `np.linspace(` `-` `1` `, ` `1` `, ` `10` `) ` `Y, X ` `=` `np.meshgrid(x, y) ` `u ` `=` `1` `-` `X` `*` `*` `2` `+` `Y ` `v ` `=` `-` `1` `+` `X ` `-` `Y` `*` `*` `2` ` ` `# Create streamline figure ` `fig ` `=` `ff.create_streamline(x, y, u, v, arrow_scale` `=` `.` `1` `) ` `fig.show()` |

*chevron_right*

*filter_none*

**Output:**

## Plotting the Source Point

The source point can be plot using the scatterplot() method of the graph_objects class. In this, the streamline plot and the position of the marker in the scatterplot are tweaked in such a way that it seems that all the stream is originating from a particular source.

**Example:**

## Python3

`import` `plotly.figure_factory as ff ` `import` `plotly.graph_objects as go ` `import` `numpy as np ` ` ` `x ` `=` `np.linspace(` `-` `1` `, ` `2` `, ` `50` `) ` `y ` `=` `np.linspace(` `-` `1` `, ` `1` `, ` `50` `) ` `Y, X ` `=` `np.meshgrid(x, y) ` `u ` `=` `np.cos(X)` `*` `Y ` `v ` `=` `np.cos(y)` `*` `X ` ` ` `# Source for x and y coordinate ` `# of scatter plot ` `X, Y ` `=` `0` `, ` `0` ` ` `# Create streamline figure ` `fig ` `=` `ff.create_streamline(x, y, u, v, arrow_scale` `=` `.` `1` `) ` ` ` `fig.add_trace(go.Scatter(x` `=` `[X], y` `=` `[Y], ` ` ` `mode` `=` `'markers'` `, ` ` ` `marker_size` `=` `15` `, ` ` ` `)) ` ` ` `fig.show()` |

*chevron_right*

*filter_none*

**Output:**

Attention geek! Strengthen your foundations with the **Python Programming Foundation** Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the **Python DS** Course.

## Recommended Posts:

- Surface plots and Contour plots in Python
- 3D Volume Plots using Plotly in Python
- 3D Line Plots using Plotly in Python
- 3D Cone Plots using Plotly in Python
- 3D Surface Plots using Plotly in Python
- 3D Streamtube Plots using Plotly in Python
- Quiver Plots using Plotly in Python
- Contour Plots using Plotly in Python
- Carpet Plots using Plotly in Python
- 3D Mesh Plots using Plotly in Python
- How to make Log Plots in Plotly - Python?
- Ternary Plots in Plotly
- Plotting different types of plots using Factor plot in seaborn
- Pair plots using Scatter matrix in Pandas
- Stem and Leaf Plots in Python
- How To Make Simple Facet Plots with Seaborn Catplot in Python?
- Density Plots with Pandas in Python
- Python | Geographical plotting using plotly
- Histogram using Plotly in Python
- How to make a basic Scatterplot using Python-Plotly?

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.