How to plot y-axis on the right of the figure? Without having to make subplots

时间:2017-12-18 07:48:07

标签: python matplotlib graph

How can I change this code to make both: the y-axis and the y-axis label appear to the right? Which arguments should I pass on to plt.ylabel?

# EN: Romania - Split VAT register query
# RO: Romania - Registru plata TVA defalcata
import requests
import json
import timeit

# https://www.anaf.ro/anaf/internet/ANAF/informatii_publice/informatii_agenti_economici/RegPlataDefalcataTVA
# url = "https://webservicesp.anaf.ro/AsynchWebService/api/v3/ws/tva"
url = "https://webservicesp.anaf.ro/PlatitorTvaRest/api/v3/ws/tva"

# You may add here load data for CSV

# You may add here loop over data
#http://www.bvb.ro/FinancialInstruments/Details/FinancialInstrumentsDetails.aspx?s=snn
# data= [{"cui": '10874881', "data": '2017-12-14'}]
cui = '10874881'
date = '2017-12-14'
data_dict = {'cui': cui, 'data': date}
data = []
data.append(data_dict)

start = timeit.default_timer()
r = requests.post(url, json=data)
#print(r.text) # If you want to view entire content

key_start = r.text.find('[')
key_start+=1
key_end = r.text.find(']')

r_dict = r.text[key_start:key_end]
r_dict = json.loads(r_dict)
stop = timeit.default_timer()

print("status_code:", r.status_code)
print("data:", data) 
print("denumire:",r_dict['denumire'])
print("cui:", r_dict['cui'])
print("dataInceputSplitTVA:",r_dict['dataInceputSplitTVA'])
print("dataAnulareSplitTVA:", r_dict['dataAnulareSplitTVA'])
print("statusSplitTVA:",r_dict['statusSplitTVA'])
print("request duration:", stop - start) 

# You may add here save results to CSV

# Warning in Romanian language
# b) Orice tentativa de suprasolicitare a serverului va fi pedepsita conform reglementarilor in vigoare.
# Warning in English language
# b) Any attempt to overload the server will be punished according to the regulations in force.
#
# Results:
# status_code: 200
# data: [{'cui': '10874881', 'data': '2017-12-14'}]
# denumire: SOCIETATEA NATIONALA "NUCLEARELECTRICA" SA
# cui: 10874881
# dataInceputSplitTVA: 2017-09-29
# dataAnulareSplitTVA:  
# statusSplitTVA: True
# request duration: 0.18321414984132353

# Rough estimation of duration for request part only for 10000 records = 1832.141498 seconds

1 个答案:

答案 0 :(得分:0)

This got it working just how I wanted without having to make a subplot.

-no-CApath

Thanks @NikitaGupta for the suggestion.