forked from avinashkranjan/Amazing-Python-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbubble_chart.py
More file actions
39 lines (32 loc) · 826 Bytes
/
bubble_chart.py
File metadata and controls
39 lines (32 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import plotly.graph_objects as go
import numpy as np
np.random.seed(1)
# declaring size of arr
size = 10
size_arr = np.random.randint(low=50, high=600, size=size)
x = np.random.randint(low=0, high=30, size=size)
y = np.random.randint(low=0, high=20, size=size)
fig = go.Figure(data=[go.Scatter(
x=x,
y=y,
mode='markers',
marker=dict(
size=size_arr,
sizemode='area',
sizeref=2.*max(size_arr)/(40.**2),
sizemin=4
),
hovertemplate=" x : %{x} <br> y : %{y} <br>"
)])
# Adjusting width and height of the image
fig.layout.template = 'plotly_dark'
fig.update_layout(
title='Bubble Chart',
xaxis_title='X Axis Title',
yaxis_title='Y Axis Title',
autosize=False,
width=600,
height=600,
margin=dict(l=50, r=50, b=100, t=100, pad=4)
)
fig.show()