title: How to make a scatter plot with varying scatter size and color corresponding to a range of values from a dataframe?
body: <p>I have a Dataframe</p>
  
  <pre><code>df = 
  Magnitude,Lon,Lat,Depth
  3.5  33.3   76.2    22
  3.5  33.1   75.9    34
  2.5  30.5   79.6    25
  5.5  30.4   79.5    40
  5.1  32     78.8    58
  4.5  31.5   74      NaN
  2.1  33.9   74.7    64
  5.1  30.8   79.1    33
  1.1  32.6   78.2    78
  NaN  33.3   76      36
  5.2  32.7   79.5    36
  NaN  33.6   78.6    NaN
  </code></pre>
  
  <p>I wanted to make a scatter plot with Lon in X-Axis Lat in Y-axis and scatter points with different size according to the range of values in Magnitude ;</p>
  
  <pre><code>size =1 : Magnitude&lt;2 ,  size =1.5 : 2&lt;Magnitude&lt;3,  size =2 : 3&lt;Magnitude&lt;4,  size =2.5 : Magnitude&gt;4.
  </code></pre>
  
  <p>and with different colour according to the range of values in Depth ;</p>
  
  <pre><code> color =red : Depth&lt;30 ,  color =blue : 30&lt;Depth&lt;40,  color =black : 40&lt;Depth&lt;60,   color =yellow : Depth&gt;60
  </code></pre>
  
  <p>I am thinking to solve this problem by defining a dictionary for the size and color. ( Just giving the idea ; need the correct syntax)</p>
  
  <p><strong>More like</strong></p>
  
  <pre><code>def magnitude_size(df.Magnitude):
      if df.Magnitude &lt; 2 :
          return 1
      if df.Magnitude &gt; 2 and df.Magnitude &lt; 3 :
          return 1.5
      if df.Magnitude &gt; 3 and df.Magnitude &lt; 4 :
          return 2
      if df.Magnitude &gt; 4  :
          return 2.5
  
  
  def depth_color(df.Depth):
      if df.Depth &lt; 30 :
          return 'red'
      if df.Depth &gt; 30 and df.Depth &lt; 40 :
          return 'blue'
      if df.Depth &gt; 40 and df.Depth &lt; 60 :
          return 'black'
      if df.Depth &gt; 60  :
          return 'yellow'
  
  
  di = {
      'size': magnitude_size(df.Magnitude),
      'color' : depth_color(df.Depth)
  }
  
  plt.scatter(df.Lon,df.Lat,c=di['color'],s=di['size'])
  
  plt.show()
  
  </code></pre>
  
  <p><strong><em>If there any NaN values in Magnitude give a different symbol for the scatter point (</em>) and If there any NaN values in Depth give a different color (green)*</strong></p>
  
  <p><strong>NEED HELP</strong></p>