snipt

Ctrl+h for KB shortcuts

Python

Plot format defaults in Matplotlib

1
2
3
4
rc('font', family='serif')
rc('font', serif='Times New Roman')
rc('font', size=20)
rc('lines', linewidth=2)
https://snipt.net/embed/7cd75e7b22bd620b5f76c2768ad063a0/
https://snipt.net/raw/7cd75e7b22bd620b5f76c2768ad063a0/
7cd75e7b22bd620b5f76c2768ad063a0
python
Python
4
2016-09-24T01:22:42
True
False
False
Nov 20, 2012 at 01:57 PM
/api/public/snipt/50528/
plot-format-defaults-in-matplotlib
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="n">rc</span><span class="p">(</span><span class="s">&#39;font&#39;</span><span class="p">,</span> <span class="n">family</span><span class="o">=</span><span class="s">&#39;serif&#39;</span><span class="p">)</span> </span><span id="L-2"><a name="L-2"></a><span class="n">rc</span><span class="p">(</span><span class="s">&#39;font&#39;</span><span class="p">,</span> <span class="n">serif</span><span class="o">=</span><span class="s">&#39;Times New Roman&#39;</span><span class="p">)</span> </span><span id="L-3"><a name="L-3"></a><span class="n">rc</span><span class="p">(</span><span class="s">&#39;font&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">20</span><span class="p">)</span> </span><span id="L-4"><a name="L-4"></a><span class="n">rc</span><span class="p">(</span><span class="s">&#39;lines&#39;</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> </span></pre></div> </td></tr></table>
"plot format default", Matplotlib, Python, default, format, plot

Text only

Turn off the 'q' problem with fonts under Linux

pdf(..., useDingbats = F) 
https://snipt.net/embed/c1ddbc98f33fed3511cc1fb5bdfa29e5/
https://snipt.net/raw/c1ddbc98f33fed3511cc1fb5bdfa29e5/
c1ddbc98f33fed3511cc1fb5bdfa29e5
text
Text only
1
2016-09-24T20:14:01
True
False
False
/api/public/snipt/33747/
turn-off-the-q-problem-with-fonts-under-linux
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>pdf(..., useDingbats = F) </span></pre></div> </td></tr></table>
font, pdf, plot, r

S

ggplot point with shape and facet wrap

1
2
3
4
# simple example
gp <- ggplot(data , aes(x=datax,y=datay,color=datacolor, shape=datashpae)) + geom_point()
gp + facet_wrap(~var1,scales='free') +opts(title='Vary Delay to Other Patch')
ggsave('data_summary_allSub_v1.png')
https://snipt.net/embed/9332e37dd6311a8c44e32f322c3a16c0/
https://snipt.net/raw/9332e37dd6311a8c44e32f322c3a16c0/
9332e37dd6311a8c44e32f322c3a16c0
splus
S
6
2016-09-24T09:33:25
True
False
False
/api/public/snipt/28964/
ggplot-point-with-shape-and-facet-wrap
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="c1"># simple example</span> </span><span id="L-2"><a name="L-2"></a>gp <span class="o">&lt;-</span> ggplot<span class="p">(</span>data <span class="p">,</span> aes<span class="p">(</span>x<span class="o">=</span>datax<span class="p">,</span>y<span class="o">=</span>datay<span class="p">,</span>color<span class="o">=</span>datacolor<span class="p">,</span> shape<span class="o">=</span>datashpae<span class="p">))</span> <span class="o">+</span> geom_point<span class="p">()</span> </span><span id="L-3"><a name="L-3"></a>gp <span class="o">+</span> facet_wrap<span class="p">(</span><span class="o">~</span>var1<span class="p">,</span>scales<span class="o">=</span><span class="s">&#39;free&#39;</span><span class="p">)</span> <span class="o">+</span>opts<span class="p">(</span>title<span class="o">=</span><span class="s">&#39;Vary Delay to Other Patch&#39;</span><span class="p">)</span> </span><span id="L-4"><a name="L-4"></a>ggsave<span class="p">(</span><span class="s">&#39;data_summary_allSub_v1.png&#39;</span><span class="p">)</span> </span></pre></div> </td></tr></table>
facet, ggplot, graph, plot, r, scatter

S

plot the chla over time, 21.08 as a bystander

1
2
3
4
5
6
7
8
names=c("11.02.09","31.03.09","07.04.09","14.04.09","05.06.09","16.06.09")
tmp <- mimas_env2
tmp <- tmp[-1,]
plot(tmp$chla,type="l")
text(which(rownames(tmp) %in% names),tmp[which(rownames(tmp) %in% names),9]+0.8,names)
points(which(rownames(tmp) %in% names),tmp[which(rownames(tmp) %in% names),9],col="red")
points(0,mimas_env2[1,9],col="red")
text(0,mimas_env2[1,9]+0.8,"21.08.08")
https://snipt.net/embed/e69a82ceb5a471c181667fd9090ae45a/
https://snipt.net/raw/e69a82ceb5a471c181667fd9090ae45a/
e69a82ceb5a471c181667fd9090ae45a
splus
S
8
2016-09-16T18:07:57
True
False
False
/api/public/snipt/24314/
plot-the-chla-over-time-2108-as-a-bystander
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>names<span class="o">=</span><span class="kt">c</span><span class="p">(</span><span class="s">&quot;11.02.09&quot;</span><span class="p">,</span><span class="s">&quot;31.03.09&quot;</span><span class="p">,</span><span class="s">&quot;07.04.09&quot;</span><span class="p">,</span><span class="s">&quot;14.04.09&quot;</span><span class="p">,</span><span class="s">&quot;05.06.09&quot;</span><span class="p">,</span><span class="s">&quot;16.06.09&quot;</span><span class="p">)</span> </span><span id="L-2"><a name="L-2"></a>tmp <span class="o">&lt;-</span> mimas_env2 </span><span id="L-3"><a name="L-3"></a>tmp <span class="o">&lt;-</span> tmp<span class="p">[</span><span class="m">-1</span><span class="p">,]</span> </span><span id="L-4"><a name="L-4"></a>plot<span class="p">(</span>tmp<span class="o">$</span>chla<span class="p">,</span>type<span class="o">=</span><span class="s">&quot;l&quot;</span><span class="p">)</span> </span><span id="L-5"><a name="L-5"></a>text<span class="p">(</span><span class="kp">which</span><span class="p">(</span><span class="kp">rownames</span><span class="p">(</span>tmp<span class="p">)</span> <span class="o">%in%</span> <span class="kp">names</span><span class="p">),</span>tmp<span class="p">[</span><span class="kp">which</span><span class="p">(</span><span class="kp">rownames</span><span class="p">(</span>tmp<span class="p">)</span> <span class="o">%in%</span> <span class="kp">names</span><span class="p">),</span><span class="m">9</span><span class="p">]</span><span class="m">+0.8</span><span class="p">,</span><span class="kp">names</span><span class="p">)</span> </span><span id="L-6"><a name="L-6"></a>points<span class="p">(</span><span class="kp">which</span><span class="p">(</span><span class="kp">rownames</span><span class="p">(</span>tmp<span class="p">)</span> <span class="o">%in%</span> <span class="kp">names</span><span class="p">),</span>tmp<span class="p">[</span><span class="kp">which</span><span class="p">(</span><span class="kp">rownames</span><span class="p">(</span>tmp<span class="p">)</span> <span class="o">%in%</span> <span class="kp">names</span><span class="p">),</span><span class="m">9</span><span class="p">],</span>col<span class="o">=</span><span class="s">&quot;red&quot;</span><span class="p">)</span> </span><span id="L-7"><a name="L-7"></a>points<span class="p">(</span><span class="m">0</span><span class="p">,</span>mimas_env2<span class="p">[</span><span class="m">1</span><span class="p">,</span><span class="m">9</span><span class="p">],</span>col<span class="o">=</span><span class="s">&quot;red&quot;</span><span class="p">)</span> </span><span id="L-8"><a name="L-8"></a>text<span class="p">(</span><span class="m">0</span><span class="p">,</span>mimas_env2<span class="p">[</span><span class="m">1</span><span class="p">,</span><span class="m">9</span><span class="p">]</span><span class="m">+0.8</span><span class="p">,</span><span class="s">&quot;21.08.08&quot;</span><span class="p">)</span> </span></pre></div> </td></tr></table>
curve, plot, r
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.