<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Saurabh Pradhan</title>
 <link href="https://srbhp.github.io/atom.xml" rel="self"/>
 <link href="https://srbhp.github.io/"/>
 <updated>2024-07-13T16:12:10+00:00</updated>
 <id>https://srbhp.github.io</id>
 <author>
   <name>Saurabh Pradhan</name>
   <email></email>
 </author>

 
 <entry>
   <title>Matplotlib</title>
   <link href="https://srbhp.github.io/2021/04/19/matplotlib/"/>
   <updated>2021-04-19T00:00:00+00:00</updated>
   <id>https://srbhp.github.io/2021/04/19/matplotlib</id>
   <content type="html">&lt;h1 id=&quot;matplotlib-tricks&quot;&gt;matplotlib-tricks&lt;/h1&gt;
&lt;p&gt;Various tricks to make better plots in Matplotlib&lt;/p&gt;

&lt;h3 id=&quot;right-align-legends&quot;&gt;right align legends&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vp = leg._legend_box._children[-1]._children[0]
#for c in vp._children:
#    c._children.reverse()
vp.align=&quot;right&quot; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;continuous-color-for-line-plot&quot;&gt;continuous color for line plot&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cm = plt.get_cmap('hsv')
NUM_COLORS = 10
colorList = [cm(i/(1.*NUM_COLORS)) for i in range(NUM_COLORS)] # plt.plot(,color =)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;colormap-from-a-list-of-colors&quot;&gt;Colormap from a list of colors&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;from matplotlib import colors
cmap=colors.LinearSegmentedColormap.from_list(&quot;mycolor&quot;,['white', 'red','green','black']) 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;figure-label-for-subplots&quot;&gt;Figure label for subplots&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;labelbox =   dict(boxstyle=&quot;circle,pad=0.15&quot;, fc=&quot;cyan&quot;, ec=&quot;b&quot;,lw=0.5) 
plt.annotate(&quot;a&quot;,xy = (0,1),   bbox=labelbox )
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;latex&quot;&gt;Latex&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;plt.rc('text', usetex=True)
plt.rc('text.latex', preamble=r'\usepackage{amsmath}')
plt.rcParams[&quot;font.family&quot;] = &quot;serif&quot;
plt.rcParams[&quot;mathtext.fontset&quot;] = &quot;dejavuserif&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;add-a-single-colorbar-for-many-subplots&quot;&gt;Add a single colorbar for many subplots&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;im = pl.scatter or plt.imshow
fig = plt.gcf()
plt.subplots_adjust(right=0.8)
cbar_ax = fig.add_axes([0.85, 0.15, 0.05, 0.7])
plt.colorbar(im, cax=cbar_ax)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Neovim</title>
   <link href="https://srbhp.github.io/2020/09/26/neovim/"/>
   <updated>2020-09-26T00:00:00+00:00</updated>
   <id>https://srbhp.github.io/2020/09/26/neovim</id>
   <content type="html">&lt;h3 id=&quot;my--neovim-config-file--should-be-kept-at-confignviminitvim&quot;&gt;My  NeoVim Config file ( Should be kept at ~/.config/nvim/init.vim)&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;https://github.com/srbhp/srbhp.github.io/raw/master/public/neovim.png&quot; alt=&quot;NeoVim&quot; title=&quot;NeoVim&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Config file : &lt;a href=&quot;https://raw.githubusercontent.com/srbhp/sysconf/master/init.vim&quot;&gt;NeoVim Config&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>C++ header file only library for simple hdf5 file input/output</title>
   <link href="https://srbhp.github.io/2020/07/23/simple-hdf5-io/"/>
   <updated>2020-07-23T00:00:00+00:00</updated>
   <id>https://srbhp.github.io/2020/07/23/simple-hdf5-io</id>
   <content type="html">&lt;h1 id=&quot;h5stream&quot;&gt;&lt;a href=&quot;https://github.com/srbhp/h5stream&quot;&gt;h5stream&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Header only library for HDF5 input/output&lt;/p&gt;

&lt;h3 id=&quot;example&quot;&gt;Example&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  // Create File
  h5stream file(&quot;sample.h5&quot;, &quot;tr&quot;);

  // Create a vector
  std::vector&amp;lt;double&amp;gt; matrix { 1, 2, 3282, 932 };
  // Write to the file
  file.write&amp;lt;double&amp;gt;(matrix, &quot;matrix&quot;); // Call write_vector

  //Read data from the file
  auto xx = file.read&amp;lt;double&amp;gt;(&quot;matrix&quot;);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Source Code : &lt;a href=&quot;https://github.com/srbhp/h5stream&quot;&gt;h5stream&lt;/a&gt;&lt;/p&gt;

</content>
 </entry>
 

</feed>
