Plotly is a Python library which 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.
Scatter plot using graph_objects class
Scatter plot are those charts in which data points are represented horizontally and on vertical axis to show that how one variable affect on another variable. The scatter() method of graph_objects class produces a scatter trace. The mode of the property decides the appearance of data points.
Syntax: plotly.graph_objects.Scatter(arg=None, cliponaxis=None, connectgaps=None, customdata=None, customdatasrc=None, dx=None, dy=None, error_x=None, error_y=None, fill=None, fillcolor=None, groupnorm=None, hoverinfo=None, hoverinfosrc=None, hoverlabel=None, hoveron=None, hovertemplate=None, hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, idssrc=None, legendgroup=None, line=None, marker=None, meta=None, metasrc=None, mode=None, name=None, opacity=None, orientation=None, r=None, rsrc=None, selected=None, selectedpoints=None, showlegend=None, stackgaps=None, stackgroup=None, stream=None, t=None, text=None, textfont=None, textposition=None, textpositionsrc=None, textsrc=None, texttemplate=None, texttemplatesrc=None, tsrc=None, uid=None, uirevision=None, unselected=None, visible=None, x=None, x0=None, xaxis=None, xcalendar=None, xsrc=None, y=None, y0=None, yaxis=None, ycalendar=None, ysrc=None, **kwargs)
|dx||Sets the x coordinate step.|
|dy||Sets the y coordinate step.|
|x||Sets the x coordinates.|
|x0||Alternate to x. Builds a linear space of x coordinates. Use with dx where x0 is the starting coordinate and dx the step.|
|y||Sets the y coordinates.|
|y0||Alternate to y. Builds a linear space of y coordinates. Use with dy where y0 is the starting coordinate and dy the step.|
Presenting Scatter with a Color Dimension
Color scale can be shown using the showscale parameter. This parameter takes a bollean value. If the value is true then the scale is shown otherwise not.
Styling Scatter Plots
In scatter plot can be styled using keywords arguments, let’s see the examples given below:
Example 1: Changing the color of the graph
Example 2: Using tips dataset
Bubble Scatter Plots
The bubble scatter plot can be created using the marker size. Marker size and color are used to control the overall size of the marker. Marker size helps to maintain the color inside the bubble in the graph.
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.
- 3D Scatter Plot using graph_objects Class in Plotly-Python
- Scatter plot using Plotly in Python
- 3D scatter plot using Plotly in Python
- Box plot in Plotly using graph_objects class
- Sunburst Plot using graph_objects class in plotly
- plotly.express.scatter() function in Python
- Plot Live Graphs using Python Dash and Plotly
- Pie plot using Plotly in Python
- Box Plot using Plotly in Python
- How to Create Stacked area plot using Plotly in Python?
- Sunburst Plot using Plotly in Python
- Parallel Coordinates Plot using Plotly in Python
- Carpet Contour Plot using Plotly in Python
- Ternary contours Plot using Plotly in Python
- Python Bokeh - Plotting a Scatter Plot on a Graph
- PyQtGraph – Getting Graphic Effect to Scatter Plot Graph
- PyQtGraph – Setting Graphic Effect to Scatter Plot Graph
- PyQtGraph – Setting Opacity of Spots of Scatter Plot Graph
- PyQtGraph – Moving Data of Scatter Plot Graph
- PyQtGraph – Getting View Position of Scatter Plot Graph
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.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.