Set 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. Scatter is used to actually scale the marker sizes and color based on data.

Example:

Python3




import plotly.graph_objects as px
import numpy as np
  
  
# creating random data through randomint 
# function of numpy.random 
np.random.seed(42)
  
random_x= np.random.randint(1,101,100
random_y= np.random.randint(1,101,100)
  
plot = px.Figure(data=[px.Scatter(
    x = random_x,
    y = random_y,
    mode = 'markers',
    marker_size = [115, 20, 30])
])
                   
plot.show()


Output:

Bubble chart using Plotly in Python

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.

Similar Reads

Bubble Chart

The bubble chart in Plotly is created using the scatter plot. It can be created using the scatter() method of plotly.express. A bubble chart is a data visualization which helps to displays multiple circles (bubbles) in a two-dimensional plot as same in scatter plot. A bubble chart is primarily used to depict and show relationships between numeric variables....

Set Marker Size

...

Scaling the Size of Bubble Charts

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. Scatter is used to actually scale the marker sizes and color based on data....

Showing Color scale

...

Contact Us