<div dir="ltr"><div class="gmail_default" style="font-family:garamond,serif;font-size:large">Thanks Juan. Thanks a lot. :) </div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><span style="font-family:garamond,serif;font-size:large">With Thanks and Regards.</span></div><div>-------------------------------------------------------------------------</div><div><font face="garamond,serif"><font size="4">Ravindra Thakkar</font></font></div><div><font face="garamond,serif"><font size="4">Associate Scientist,</font></font></div><div><span style="font-family:garamond,serif;font-size:large">Kansas State University,</span><br></div><div><font face="garamond, serif" size="4">Manhattan, Kansas (USA)</font></div><div>-------------------------------------------------------------------------<br></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Fri, Mar 30, 2018 at 9:45 AM, Juan Nunez-Iglesias <span dir="ltr"><<a href="mailto:jni.soma@gmail.com" target="_blank">jni.soma@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div>
<div name="messageBodySection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif">Ah, I didn’t notice that you were doing pandas plotting instead of matplotlib. This is ok: pandas plot takes an ax= keyword that lets you specify an axis on which to plot. You can then ignore the secondary_y nonsense which is unnecessary if you use the matplotlib object-oriented API. The code below works for me. (Apologies for the primary y label, as I don’t know what your quantities represent. ;)
<div><br></div>
<div>Note, the title and x label need to happen on the first axes you declare, which in this case is ax_bar. If I tried to add them to ax_line nothing happened.<br>
<div><br></div>
<div>
<div>import matplotlib.pyplot as plt</div>
<div>import numpy as np</div>
<div>import pandas as pd</div>
<div><br></div>
<div>width = 1 # width of a bar</div>
<div><br></div>
<div>m1_t = pd.DataFrame({</div>
<div>    'SD-0' :[246,211,212,85.3,131,370,<wbr>124.3,115.8,135.3,145.2,104.3,<wbr>59,42.4,55.8,20.2,13.9,5.15],</div>
<div>    'SD-15' :[236,176,169,126,152,86.8,98,<wbr>212,164,131,91,77.9,18.5,30.5,<wbr>21.4,6.3,13.5],</div>
<div>    '15':[715,1260,639,783,949,<wbr>1032,1155,1343,1095,744,451,<wbr>304,251,110,88.6,56.2,52.2],</div>
<div>    '0' :[530,1173,762,669.5,867,1018,<wbr>1221,1203,1148,632,501,338,<wbr>265,195,135,111,107]})</div>
<div><br></div>
<div>fig, ax_bar = plt.subplots()</div>
<div>ax_line = ax_bar.twinx()</div>
<div><br></div>
<div>m1_t[['SD-0','SD-15']].plot(<wbr>kind='bar', width = width, ax=ax_bar)</div>
<div>m1_t['0'].plot(label='0 ppt',marker='o', ax=ax_line)</div>
<div>m1_t['15'].plot(label='15 ppt',marker='o', ax=ax_line)</div>
<div><br></div>
<div>ax_line.set_xlim(-width, m1_t.shape[0] + width)</div>
<div>ax_line.set_xticklabels(('0.<wbr>25','0.5','1','2','4','6','8',<wbr>'12','24','48','96','144','<wbr>192','288','336','432','528'))</div>
<div>ax_line.legend(loc='upper right', bbox_to_anchor=(1,0.85))</div>
<div><br></div>
<div>ax_line.set_ylabel("<wbr>Concentration")</div>
<div>ax_bar.set_title("Fish Study")</div>
<div>ax_bar.set_xlabel("time")</div>
<div>ax_bar.set_ylabel("whatever")</div>
<div><br></div>
<div>plt.tight_layout()</div>
<div>plt.show()</div>
<div><br></div>
</div>
</div>
</div><div><div class="h5">
<div name="messageReplySection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif"><br>
On 29 Mar 2018, 6:46 PM -0400, Ravi Thakkar <<a href="mailto:ravi.thakkar369@gmail.com" target="_blank">ravi.thakkar369@gmail.com</a>>, wrote:<br>
<blockquote type="cite" style="margin:5px 5px;padding-left:10px;border-left:thin solid #1abc9c">
<div dir="ltr">
<div class="gmail_default" style="font-family:garamond,serif;font-size:large">Hi Juan,</div>
<div class="gmail_default" style="font-family:garamond,serif;font-size:large">Thanks. I want to draw bar graph and its showing error. I dont have mathematically derived data on axis, I have straight forward observations.   I want to compare concentration of two different drug on by bar graph and another with two line graph. All in same graph. If you can suggest any example. TIA.</div>
<div class="gmail_extra">
<div>
<div class="m_1706799796434038578gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div><br></div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">On Thu, Mar 29, 2018 at 12:20 PM, Juan Nunez-Iglesias <span dir="ltr"><<a href="mailto:jni.soma@gmail.com" target="_blank">jni.soma@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:5px 5px;padding-left:10px;border-left:thin solid #e67e22">
<div>
<div name="messageBodySection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif">Hi Ravi, and welcome!
<div><br></div>
<div>I think this example does what you want?</div>
<div><a href="https://matplotlib.org/examples/api/two_scales.html" target="_blank">https://matplotlib.org/example<wbr>s/api/two_scales.html</a><br></div>
<div><br></div>
<div>Juan.</div>
</div>
<div name="messageReplySection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif">
<div>
<div class="m_1706799796434038578h5"><br>
On 29 Mar 2018, 1:11 PM -0400, Ravi Thakkar <<a href="mailto:ravi.thakkar369@gmail.com" target="_blank">ravi.thakkar369@gmail.com</a>>, wrote:<br></div>
</div>
<blockquote type="cite" style="margin:5px 5px;padding-left:10px;border-left:thin solid #3498db">
<div>
<div class="m_1706799796434038578h5">
<div dir="ltr">
<div style="font-family:garamond,serif;font-size:large">Hi,</div>
<div style="font-family:garamond,serif;font-size:large">Guys, I am new to programming field, learning python to represent my research data. </div>
<div style="font-family:garamond,serif;font-size:large">Anyone here please help me to get the x axis label and separate label on both y axis. (as indicated in attached image).</div>
<div style="font-family:garamond,serif;font-size:large">Code is attached.</div>
<div style="font-family:garamond,serif;font-size:large"><br>
--</div>
<div style="font-family:garamond,serif;font-size:large">Ravi.</div>
<div>
<div class="m_1706799796434038578m_-3191157038575636397gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
______________________________<wbr>_________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@python.org" target="_blank">Matplotlib-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/matplotlib-users</a><br></blockquote>
<div></div>
</div>
</div>
</blockquote>
</div>
<br></div>
</div>
</blockquote>
<div></div>
</div>
</div></div></div>

</blockquote></div><br></div>