Skip to content

Commit ebb3b30

Browse files
Create Addition _of _Data _Visualization.py
Solved issue no. tarunsinghofficial#2654 To add data visualization codes in Python, you can use libraries like matplotlib, seaborn, and plotly. Here's an example of how to add data visualization codes using matplotlib:
1 parent d321f35 commit ebb3b30

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

Addition _of _Data _Visualization.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import matplotlib.pyplot as plt
2+
import seaborn as sns
3+
import plotly.express as px
4+
5+
# Sample data
6+
x = [1, 2, 3, 4, 5]
7+
y = [2, 4, 6, 8, 10]
8+
9+
# Create a line plot
10+
plt.plot(x, y)
11+
12+
# Add title and labels
13+
plt.title('Line Plot Example')
14+
plt.xlabel('X-axis')
15+
plt.ylabel('Y-axis')
16+
17+
# Show the plot
18+
plt.show()
19+
20+
# Sample data
21+
x = [1, 2, 3, 4, 5]
22+
y = [2, 4, 6, 8, 10]
23+
24+
# Create a scatter plot
25+
sns.scatterplot(x, y)
26+
27+
# Add title and labels
28+
plt.title('Scatter Plot Example')
29+
plt.xlabel('X-axis')
30+
plt.ylabel('Y-axis')
31+
32+
# Show the plot
33+
plt.show()
34+
35+
# Sample data
36+
x = ['A', 'B', 'C', 'D', 'E']
37+
y = [10, 15, 20, 25, 30]
38+
39+
# Create a bar chart
40+
fig = px.bar(x=x, y=y)
41+
42+
# Add title and labels
43+
fig.update_layout(title='Bar Chart Example', xaxis_title='X-axis', yaxis_title='Y-axis')
44+
45+
# Show the plot
46+
fig.show()
47+
48+
49+
x = [1, 2, 3, 4, 5]
50+
y = [2, 4, 6, 8, 10]
51+
52+
plt.plot(x, y)
53+
plt.title('Line Plot Example')
54+
plt.xlabel('X-axis')
55+
plt.ylabel('Y-axis')
56+
plt.show()

0 commit comments

Comments
 (0)