ich kann die Uhrsache nicht finden.
Die Daten auf X-Achse werden nicht in der richtigen Reihenfolge angezeigt. Die grossere Zahlen erscheinen zwischen den kleinen. Sie sollen doch automatisch aufsteigend nach rechts verschoben werden. Hat jemand eine Idee?
Leider habe ich nicht hingekriegt hier das Bild davon hochzuladen. :K
Code: Alles auswählen
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
#from config.txt import polo_key, polo_secret
import requests, json
import numpy as np
import matplotlib.pyplot as plt
def public_method(command): #holt die daten aus Poloniex. Typ dict
#Variablen für Funktion:
#returnLoanOrders¤cy=LTC -> gibt daten von Verleiverlauf für LTC
url = 'https://poloniex.com/public?command={0}'.format(command)
api = requests.get(url)
data = json.loads(api.text)#json-Format in python-dict konvertieren
return data
Date_Lean_LTC = public_method('returnLoanOrders¤cy=LTC')# Verlei-Daten aus Poloniex rausholen
first_key = list(Date_Lean_LTC)[0]
#print(first_key)
first_list = Date_Lean_LTC[first_key]
#print(first_list)
#print(first_list[0]['rate'])
a_rate = []
a_amount = []
a_rangeMin = []
a_rangeMax = []
for second_dict in first_list:
#print(second_dict)
print(second_dict['rate'], second_dict['amount'], second_dict['rangeMin'], second_dict['rangeMax'])
a_rate = np.append(a_rate, second_dict['rate'])
a_amount = np.append(a_amount, second_dict['amount'])
a_rangeMin = np.append(a_rangeMin, second_dict['rangeMin'])
a_rangeMax = np.append(a_rangeMax, second_dict['rangeMax'])
x = a_rate
y = a_amount
plt.xticks(rotation='vertical')
plt.subplots_adjust(bottom=0.25,left=0.2)#Graph in der Fenster ausrichten
plt.bar(y,x)
plt.show()