Skip to content

Commit 5fc0ca3

Browse files
committed
made the changes in Bar chart and Pie chart
1 parent 9aa7c82 commit 5fc0ca3

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed
10.3 KB
Loading

Data-Visualization/BarChart/bar_chart.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@
1313
fig = go.Figure(go.Bar(
1414
x = x,
1515
y = y,
16+
text = y,
17+
textposition='outside',
1618
marker_color='indianred',
1719
hovertemplate = "%{x} : %{y} <extra></extra>",
18-
showlegend = False
20+
showlegend = False,
1921
))
2022

2123
# Modifying the tickangle of the xaxis, and adjusting width and height of the image
2224
fig.layout.template = 'plotly_dark'
25+
#Hiding y-axis labels
26+
layout_yaxis_visible = False
27+
layout_yaxis_showticklabels = False
2328
fig.update_layout(
24-
title = 'Bar Chart',
2529
xaxis_title = 'X Axis Title',
2630
yaxis_title = 'Y Axis Title',
2731
xaxis_tickangle = -45,
@@ -30,5 +34,8 @@
3034
height=600,
3135
margin=dict(l=50, r=50, b=100, t=100, pad=4)
3236
)
37+
# Removing the background grid and the Y-axis labels
38+
fig.update_yaxes(showgrid = False, showticklabels = False)
39+
3340
fig.show()
3441

21.2 KB
Loading

Data-Visualization/PieChart/pie_chart.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
# Adjusting width and height of the image
1616
fig.layout.template = 'plotly_dark'
17+
# To display labels with the percentage
18+
fig.update_traces(textposition = 'inside', textinfo = 'percent+label')
1719
fig.update_layout(
1820
title = 'Pie Chart',
1921
xaxis_title = 'X Axis Title',

Data-Visualization/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pip install plotly
1212
# Outputs
1313

1414
## 1. Bar Chart
15-
[![BarChart.png](https://i.postimg.cc/7hp2zLxm/BarChart.png)](https://postimg.cc/1VrXhsVq)
15+
[![Revised-Bar-Chart.png](https://i.postimg.cc/YSQWnMDv/Revised-Bar-Chart.png)](https://postimg.cc/f3TyknNs)
1616

1717
## 2. Bubble Chart
1818
[![Bubble-Chart.png](https://i.postimg.cc/6QLg17g4/Bubble-Chart.png)](https://postimg.cc/2qy015zC)
@@ -27,7 +27,7 @@ pip install plotly
2727
[![Line-Chart.png](https://i.postimg.cc/2SPLXyhY/Line-Chart.png)](https://postimg.cc/RWL0WMgp)
2828

2929
## 6. Pie Chart
30-
[![PieChart.png](https://i.postimg.cc/gJ4Jd2Xn/PieChart.png)](https://postimg.cc/1nnPrPKQ)
30+
[![Revised-Pie-Chart.png](https://i.postimg.cc/kXwwsF60/Revised-Pie-Chart.png)](https://postimg.cc/crgQ43ch)
3131

3232
## 7. Scatter Plot
3333
[![Scatter-Plot.png](https://i.postimg.cc/Pqjrww1C/Scatter-Plot.png)](https://postimg.cc/0zVsgrWv)

0 commit comments

Comments
 (0)