사용자 입력 값 집합에서 히스토그램을 플롯하려고합니다.Python : 히스토그램을 아래쪽으로 그려야합니다.
가 좋아, 나는이 내 코드를 업데이트 :
number1 = ""
number2 = ""
number3 = ""
number4 = ""
numbers = input("Enter a string of positive integers separated by spaces: ")
print(" ")
newNum = numbers.split()
line = 0
col = 0
lines = int(max(newNum))
length = len(newNum)
while line<lines:
col = 0
while col<length:
if line<int(newNum[col]):
print('* ', end = '')
else:
print(' ')
col = col+1
line = line+1
print("")
하지만 코드를 실행할 때이 얻을 :
Enter a string of positive integers separated by spaces: 1 3 20 5
* * * *
* * *
* * *
* *
* *
내가 같이 인쇄 할 내 히스토그램을 얻기 위해 지금 무엇을 놓치고 ? 또한 왜 값을 20으로 인쇄하지 않습니까?
Enter a string of positive integers separated by spaces: 1 3 20 5
* * * *
* * *
* * *
* *
* *
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
당신은 무엇을 시도? 너 어디서 붙어 있니? [묻는 방법] (https://stackoverflow.com/questions/ask/advice?)를 참조하십시오. –
위의 코드는 제가 얻은 것입니다. 나는 그것을 뒤집어 씌울 방법을 모르겠습니다. –
응용 프로그램을 모르지만 막대 그래프에 scipy 또는 matplotlib를 사용하는 옵션이 있습니까? – Kev1n91