Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8a3bf48

Browse files
committed
Added code for Waterfall,Funnel,Ternary and Contour Plots
1 parent 4a8bf7b commit 8a3bf48

File tree

9 files changed

+145
-0
lines changed

9 files changed

+145
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import plotly.graph_objects as go
2+
import numpy as np
3+
4+
# X , Y , Z cordinates
5+
x_cord = np.arange(0, 50, 2)
6+
y_cord = np.arange(0, 50, 2)
7+
z_function = np.sin((x_cord + y_cord)/2)
8+
9+
fig = go.Figure(data=go.Contour(x=x_cord,
10+
y=y_cord,
11+
z=z_function,
12+
colorscale='darkmint',
13+
contours=dict(
14+
showlabels=False, # show labels on contours
15+
labelfont=dict( # label font properties
16+
size=12,
17+
color='white',
18+
)
19+
),
20+
colorbar=dict(
21+
thickness=25,
22+
thicknessmode='pixels',
23+
len=1.0,
24+
lenmode='fraction',
25+
outlinewidth=0,
26+
title='Title',
27+
titleside='right',
28+
titlefont=dict(
29+
size=14,
30+
family='Arial, sans-serif')
31+
32+
),
33+
34+
)
35+
)
36+
37+
fig.update_layout(
38+
title='Contour Plot',
39+
xaxis_title='X Axis Title',
40+
yaxis_title='Y Axis Title',
41+
autosize=False,
42+
width=900,
43+
height=600,
44+
margin=dict(l=50, r=50, b=100, t=100, pad=4)
45+
)
46+
fig.show()
84.6 KB
Loading[フレーム]
45.3 KB
Loading[フレーム]
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from plotly import graph_objects as go
2+
3+
fig = go.Figure()
4+
5+
fig.add_trace(go.Funnel(
6+
name = 'India',
7+
y = ["McDonalds", "Dominoz", "PizzaHut", "Subway" , "MadOverDonuts" , "Keventers"],
8+
x = [150, 140, 40, 50, 40 , 20],
9+
textposition = "inside",
10+
textinfo = "value+percent initial"))
11+
12+
fig.add_trace(go.Funnel(
13+
name = 'Bangladesh',
14+
orientation = "h",
15+
y = ["McDonalds", "Dominoz", "PizzaHut", "Subway"],
16+
x = [50, 60, 40, 30],
17+
textposition = "inside",
18+
textinfo = "value+percent previous"))
19+
20+
fig.add_trace(go.Funnel(
21+
name = 'SriLanka',
22+
orientation = "h",
23+
y = ["McDonalds", "Dominoz", "PizzaHut", "Subway" ,"MadOverDonuts" ],
24+
x = [90, 70, 50, 30, 10],
25+
textposition = "outside",
26+
textinfo = "value+percent total"))
27+
28+
fig.update_layout(
29+
title = "Funnel Chart for Food Sales in Asian Countries",
30+
showlegend = True
31+
)
32+
fig.show()

‎Data-Visualization/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,16 @@ pip install plotly
3535
# Author
3636
[Elita Menezes](https://github.com/ELITA04/)
3737

38+
## 8. Contour Plot
39+
[![contourplot.png](https://i.postimg.cc/q7w2RdBT/contourplot.png)](https://postimg.cc/v114qk6q)
40+
41+
## 9. Ternary Plot
42+
[![ternaryplot.png](https://i.postimg.cc/2SpQ9w9P/ternaryplot.png)](https://postimg.cc/crmtrQSm)
43+
## 10. Waterfall Chart
44+
[![Water-Fall.png](https://i.postimg.cc/nznTRkrH/Water-Fall.png)](https://postimg.cc/mc6Qh77q)
45+
## 11. Funnel Chart
46+
[![Funnel-Chart.png](https://i.postimg.cc/bvhRrTQQ/Funnel-Chart.png)](https://postimg.cc/FYTSn0CR)
47+
48+
49+
# Author
50+
[Divya Rao](https://github.com/dsrao711/)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import plotly.express as px
2+
import plotly.graph_objects as go
3+
4+
df = px.data.election()
5+
6+
fig = go.Figure(go.Scatterternary({
7+
'mode': 'markers',
8+
'a': df['Joly'],
9+
'b': df['Coderre'],
10+
'c': df['Bergeron'],
11+
'marker': {
12+
'color': 'green',
13+
'size': 14,
14+
} ,
15+
16+
}))
17+
fig.update_layout({
18+
'title': 'Ternary Scatter Plot',
19+
'ternary':
20+
{
21+
'sum':1,
22+
'aaxis':{'title': 'Joly', 'min': 0.01, 'linewidth':2, 'ticks':'outside' },
23+
'baxis':{'title': 'Coderre', 'min': 0.01, 'linewidth':2, 'ticks':'outside' },
24+
'caxis':{'title': 'Bergeron', 'min': 0.01, 'linewidth':2, 'ticks':'outside' }
25+
},
26+
'showlegend': False
27+
})
28+
29+
30+
fig.show()
49.5 KB
Loading[フレーム]
30 KB
Loading[フレーム]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import plotly.express as px
2+
import plotly.graph_objects as go
3+
4+
fig = go.Figure(go.Waterfall(
5+
name = "20",
6+
orientation = "v",
7+
measure = ["relative", "relative", "relative", "relative", "relative", "total"],
8+
x = ["Exp1", "Exp2", "Exp3", "Exp4", "Exp5", "Exp6"],
9+
textposition = "outside",
10+
text = ["100", "50", "130", "200", "40", "Total"],
11+
y = [100, +50, 130, 200, 40, 0 ],
12+
connector = {"line":{"color":"rgb(63, 63, 63)"}},
13+
increasing = {"marker":{"color":"green"}},
14+
totals = {"marker":{"color":"blue"}}
15+
))
16+
17+
fig.update_layout(
18+
title = "Waterfall Chart",
19+
showlegend = True ,
20+
xaxis_title='X Axis Title',
21+
yaxis_title='Y Axis Title',
22+
)
23+
24+
fig.show()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /