[Matplotlib-users] Lien&bar combination graph.

Ravi Thakkar ravi.thakkar369 at gmail.com
Thu Mar 29 13:05:12 EDT 2018


Hi,
Guys, I am new to programming field, learning python to represent my
research data.
Anyone here please help me to get the x axis label and separate label on
both y axis. (as indicated in attached image).
Code is attached.

--
Ravi.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180329/ae69744a/attachment-0001.html>
-------------- next part --------------
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

width = 1 # width of a bar

m1_t = pd.DataFrame({
    'SD-0' :[246,211,212,85.3,131,370,124.3,115.8,135.3,145.2,104.3,59,42.4,55.8,20.2,13.9,5.15],
    'SD-15' :[236,176,169,126,152,86.8,98,212,164,131,91,77.9,18.5,30.5,21.4,6.3,13.5],
    '15':[715,1260,639,783,949,1032,1155,1343,1095,744,451,304,251,110,88.6,56.2,52.2],
    '0' :[530,1173,762,669.5,867,1018,1221,1203,1148,632,501,338,265,195,135,111,107]})
    





m1_t[['SD-0','SD-15']].plot(kind='bar', width = width)
m1_t['0'].plot(secondary_y=True,label='0 ppt',marker='o')
m1_t['15'].plot(secondary_y=True,label='15 ppt',marker='o')



ax = plt.gca()
plt.xlim([-width, len(m1_t['15'])-width])
ax.set_xticklabels(('0.25','0.5','1','2','4','6','8','12','24','48','96','144','192','288','336','432','528'))
ax.legend(loc='upper right', bbox_to_anchor=(1,0.85))






plt.title("Fish Study")
plt.ylabel("Concentration")
plt.xlabel("time")



 
plt.tight_layout()

plt.show()

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Figure_1.png
Type: image/png
Size: 47443 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180329/ae69744a/attachment-0001.png>


More information about the Matplotlib-users mailing list