"legend matplotlib twinx" Code Answer's

You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "legend matplotlib twinx" answered properly. Developers are finding an appropriate answer about legend matplotlib twinx related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like legend matplotlib twinx. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on legend matplotlib twinx. 

legend matplotlib twinx

By MohsenMohsen on Mar 10, 2021
lns = lns1+lns2+lns3
labs = [l.get_label() for l in lns]
ax.legend(lns, labs, loc=0)

Add Comment

0

matplotlib twinx legend

By HotFlowHotFlow on Jun 14, 2021
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
rc('mathtext', default='regular')

time = np.arange(10)
temp = np.random.random(10)*30
Swdown = np.random.random(10)*100-10
Rn = np.random.random(10)*100-10

fig = plt.figure()
ax = fig.add_subplot(111)

lns1 = ax.plot(time, Swdown, '-', label = 'Swdown')
lns2 = ax.plot(time, Rn, '-', label = 'Rn')
ax2 = ax.twinx()
lns3 = ax2.plot(time, temp, '-r', label = 'temp')

# added these three lines
lns = lns1+lns2+lns3
labs = [l.get_label() for l in lns]
ax.legend(lns, labs, loc=0)

ax.grid()
ax.set_xlabel("Time (h)")
ax.set_ylabel(r"Radiation ($MJ\,m^{-2}\,d^{-1}$)")
ax2.set_ylabel(r"Temperature ($^\circ$C)")
ax2.set_ylim(0, 35)
ax.set_ylim(-20,100)
plt.show()

Source: stackoverflow.com

Add Comment

0

All those coders who are working on the Whatever based application and are stuck on legend matplotlib twinx can get a collection of related answers to their query. Programmers need to enter their query on legend matplotlib twinx related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about legend matplotlib twinx for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of legend matplotlib twinx while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "legend matplotlib twinx". Visit this developer's friendly online web community, CodeProZone, and get your queries like legend matplotlib twinx resolved professionally and stay updated to the latest Whatever updates. 

Whatever answers related to "legend matplotlib twinx"

View All Whatever queries

Whatever queries related to "legend matplotlib twinx"

Browse Other Code Languages

CodeProZone