<div dir="ltr">How are you determining that the figure dpi is still 72?<div><br></div><div>Tom</div><div><br></div><div>ps please subscribe to the mailing list so you can post with out moderation intervention.</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, May 16, 2016 at 1:53 PM <a href="mailto:tanweiwei@pku.edu.cn">tanweiwei@pku.edu.cn</a> <<a href="mailto:tanweiwei@pku.edu.cn">tanweiwei@pku.edu.cn</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
<div><span></span><table><tbody><tr><td><div><div><b></b></div>
</div>
</td>

<td>
<div>
<div>
<p>I am learing to use matplotlib to produce high quality picture for my paper. The demand dpi of this magzine is 300. </p>
<p>So, I wrote some example codes:</p>
<pre style="font-size:15px"><code><span>import</span><span> numpy </span><span>as</span><span> np
</span><span>import</span><span> matplotlib</span><span>.</span><span>pyplot </span><span>as</span><span> plt
a </span><span>=</span><span> np</span><span>.</span><span>linspace</span><span>(</span><span>0</span><span>,</span><span> </span><span>10</span><span>,</span><span> </span><span>100</span><span>)</span><span>
b </span><span>=</span><span> np</span><span>.</span><span>linspace</span><span>(</span><span>0</span><span>,</span><span> </span><span>20</span><span>,</span><span> </span><span>100</span><span>)</span><span>
plt</span><span>.</span><span>plot</span><span>(</span><span>a</span><span>,</span><span> b</span><span>,</span><span> </span><span>'o'</span><span>)</span><span>
plt</span><span>.</span><span>xlabel</span><span>(</span><span>r</span><span>'\$x\$'</span><span>)</span><span>
plt</span><span>.</span><span>ylabel</span><span>(</span><span>r</span><span>'\$y\$'</span><span>)</span><span>
plt</span><span>.</span><span>grid</span><span>(</span><span>True</span><span>)</span><span>
plt</span><span>.</span><span>savefig</span><span>(</span><span>'fig1.jpg'</span><span>,</span><span> dpi</span><span>=</span><span>300</span><span>,</span><span> format</span><span>=</span><span>'jpg'</span><span>)</span></code></pre>
<p>But I got a picure whose dpi is 72, and its size is 2400*1800. I'm
confused about this outcome. I searched the Internet and some
references about dpi setting, but I can't solve this problem anyway.</p>
<p>Also I tried those:</p>
<pre style="font-size:15px"><code><span>matplotlib</span><span>.</span><span>rcParams</span><span>[</span><span>'savefig.dpi'</span><span>]</span><span> </span><span>=</span><span> </span><span>300</span></code></pre>
<p style="font-size:15px">or</p>
<pre style="font-size:15px"><code><span>plt</span><span>.</span><span>figure</span><span>(</span><span>dpi</span><span>=</span><span>300</span><span>)</span></code></pre>
<p style="font-size:15px">or</p>
<pre style="font-size:15px"><code><span>'D:\Anaconda3\Lib\site-packages\matplotlib\mpl-data\matplotlibrc'</span><span> </span></code></pre>
<p style="font-size:15px">in this file, make</p>
<pre style="font-size:15px"><code><span>savefig</span><span>.</span><span>dpi</span><span>=</span><span>300.</span><span> </span></code></pre>
<p><strong>All of those is useless.</strong> </p>
<p>I think the reason why the size of produced figure is 2400*1800.
Because (300dpi*8 inches)*(300dpi*6 inches). The default size of figure
in rc file is 8 inches and 6 inches. But why the dpi of this figure
can't be changed!</p>
<p>My operating system is windows 10. Anaconda 3 helped me to install matplotlib module.</p>
<p><strong>Thank for your help!</strong></p></div></div></td></tr></tbody></table></div>
<div><br></div><hr style="width:210px;min-height:1px" color="#b5c4df" size="1" align="left">
<div><span><div style="margin:10px;font-size:10pt"><div style="font-size:15px"><font face="Times New Roman"><span style="line-height:23.3125px"><b>Weiwei Tan</b></span></font></div><div style="font-family:Arial;font-size:15px;line-height:23.8px"><span style="line-height:23.324px;font-family:'Times New Roman'"><b>Institute of Heavy Ion Physics</b></span></div><div style="font-family:Arial;font-size:14px;line-height:23.8px"><div style="font-family:华文细黑;line-height:23.324px"><div style="font-family:'Times New Roman';font-size:15px"><b>School of ﻿Physics，Peking University </b></div></div></div></div></span></div>
</div>_______________________________________________<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" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/matplotlib-users</a><br>
</blockquote></div>