私は、一連のユーザー入力値からヒストグラムをプロットしようとしています。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
* * * *
* * *
* * *
* *
* *
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
あなたは何を試してみましたか?あなたはどこにいらっしゃいますか? [How to ask](https://stackoverflow.com/questions/ask/advice?)をご覧ください。 –
上記のコードは私が得た限りです。私はちょうどそれを反転させる方法を必ずしも分かりません。 –
あなたのアプリケーションはわかりませんが、バーグラフにscipyまたはmatplotlibを使用するオプションはありますか? – Kev1n91