Skip to content

Update graph plotter.py #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 60 additions & 5 deletions graph plotter.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,70 @@
import matplotlib.pyplot as plt

x = [2, 4, 5]
y = [2, 3, 6]
#made input number for x and y from user input
print("Put Number For Graph 1")
input_x1 = int(input('Input 4 number for x1 axis '))
input_x2 = int(input('Input 4 number for x1 axis '))
input_x3 = int(input('Input 4 number for x1 axis '))
input_x4 = int(input('Input 4 number for x1 axis '))
input_y1 = int(input('Input 4 number for y1 axis '))
input_y2 = int(input('Input 4 number for y1 axis '))
input_y3 = int(input('Input 4 number for y1 axis '))
input_y4 = int(input('Input 4 number for y1 axis '))

plt.plot(x, y)
x1 = []
y1 = []

#add number to list
x1.append(input_x1)
x1.append(input_x2)
x1.append(input_x3)
x1.append(input_x4)
y1.append(input_y1)
y1.append(input_y2)
y1.append(input_y3)
y1.append(input_y4)

tick_label = ['one', 'two', 'three', 'four']

plt.bar(x1, y1, tick_label = tick_label, width=0.8, color=['blue', 'orange'])

#plt.plot(x1,y1, color='green', linestyle='dashed', linewidth=3, marker='o', markerfacecolor='blue', markersize=12, label = 'Line 1')

#plt.ylim(1,8)
#plt.xlim(1,8)

print("Put Number For Graph 2")
input_x1 = int(input('Input 4 number for x2 axis '))
input_x2 = int(input('Input 4 number for x2 axis '))
input_x3 = int(input('Input 4 number for x2 axis '))
input_x4 = int(input('Input 4 number for x2 axis '))
input_y1 = int(input('Input 4 number for y2 axis '))
input_y2 = int(input('Input 4 number for y2 axis '))
input_y3 = int(input('Input 4 number for y2 axis '))
input_y4 = int(input('Input 4 number for y2 axis '))

x2 = []
y2 = []

x2.append(input_x1)
x2.append(input_x2)
x2.append(input_x3)
x2.append(input_x4)
y2.append(input_y1)
y2.append(input_y2)
y2.append(input_y3)
y2.append(input_y4)


plt.plot(x2,y2, label = 'Line 2')

plt.xlabel('X Axis')

plt.ylabel( 'Y Axis')
plt.ylabel('Y Axis')

plt.title('Demo Graph - Bar Chart')

plt.legend()

plt.title('Demo Graph ')

plt.show()