nodes: 0, module; 1, function_definition; 2, function_name:interev_mag; 3, parameters; 4, block; 5, identifier:times; 6, identifier:mags; 7, default_parameter; 8, dictionary_splat_pattern; 9, expression_statement; 10, import_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, comment:# Make two subplots next to each other of time before and time after; 16, expression_statement; 17, expression_statement; 18, expression_statement; 19, expression_statement; 20, for_statement; 21, expression_statement; 22, expression_statement; 23, expression_statement; 24, expression_statement; 25, expression_statement; 26, expression_statement; 27, expression_statement; 28, expression_statement; 29, expression_statement; 30, expression_statement; 31, expression_statement; 32, expression_statement; 33, comment:# pragma: no cover; 34, return_statement; 35, identifier:size; 36, tuple; 37, identifier:kwargs; 38, comment:"""
      Plot inter-event times against magnitude.
  
      :type times: list
      :param times: list of the detection times, must be sorted the same as mags
      :type mags: list
      :param mags: list of magnitudes
      :type size: tuple
      :param size: Size of figure in inches.
  
      :returns: :class:`matplotlib.figure.Figure`
  
      .. rubric:: Example
  
      >>> from obspy.clients.fdsn import Client
      >>> from obspy import UTCDateTime
      >>> from eqcorrscan.utils.plotting import interev_mag
      >>> client = Client('IRIS')
      >>> t1 = UTCDateTime('2012-03-26T00:00:00')
      >>> t2 = t1 + (3 * 86400)
      >>> catalog = client.get_events(starttime=t1, endtime=t2, minmagnitude=3)
      >>> magnitudes = [event.preferred_magnitude().mag for event in catalog]
      >>> times = [event.preferred_origin().time for event in catalog]
      >>> interev_mag(times, magnitudes) # doctest: +SKIP
  
      .. plot::
  
          from obspy.clients.fdsn import Client
          from obspy import UTCDateTime
          from eqcorrscan.utils.plotting import interev_mag
          client = Client('IRIS')
          t1 = UTCDateTime('2012-03-26T00:00:00')
          t2 = t1 + (3 * 86400)
          catalog = client.get_events(starttime=t1, endtime=t2, minmagnitude=3)
          magnitudes = [event.preferred_magnitude().mag for event in catalog]
          times = [event.preferred_origin().time for event in catalog]
          interev_mag(times, magnitudes)
      """; 39, aliased_import; 40, assignment; 41, call; 42, assignment; 43, assignment; 44, assignment; 45, assignment; 46, assignment; 47, assignment; 48, identifier:i; 49, call; 50, block; 51, call; 52, call; 53, call; 54, call; 55, call; 56, call; 57, call; 58, call; 59, call; 60, call; 61, call; 62, assignment; 63, identifier:fig; 64, float:10.5; 65, float:7.5; 66, dotted_name; 67, identifier:plt; 68, identifier:info; 69, list_comprehension; 70, attribute; 71, argument_list; 72, identifier:times; 73, list_comprehension; 74, identifier:mags; 75, list_comprehension; 76, pattern_list; 77, call; 78, identifier:axes; 79, call; 80, identifier:pre_times; 81, list; 82, identifier:post_times; 83, list; 84, identifier:range; 85, argument_list; 86, if_statement; 87, if_statement; 88, attribute; 89, argument_list; 90, attribute; 91, argument_list; 92, attribute; 93, argument_list; 94, attribute; 95, argument_list; 96, attribute; 97, argument_list; 98, attribute; 99, argument_list; 100, attribute; 101, argument_list; 102, attribute; 103, argument_list; 104, attribute; 105, argument_list; 106, attribute; 107, argument_list; 108, attribute; 109, argument_list; 110, identifier:fig; 111, call; 112, identifier:matplotlib; 113, identifier:pyplot; 114, tuple; 115, for_in_clause; 116, identifier:info; 117, identifier:sort; 118, keyword_argument; 119, subscript; 120, for_in_clause; 121, subscript; 122, for_in_clause; 123, identifier:fig; 124, identifier:axes; 125, attribute; 126, argument_list; 127, attribute; 128, argument_list; 129, call; 130, comparison_operator:i > 0; 131, block; 132, comparison_operator:i < len(times) - 1; 133, block; 134, subscript; 135, identifier:scatter; 136, identifier:pre_times; 137, subscript; 138, subscript; 139, identifier:set_title; 140, string; 141, subscript; 142, identifier:set_ylabel; 143, string; 144, subscript; 145, identifier:set_xlabel; 146, string; 147, identifier:plt; 148, identifier:setp; 149, call; 150, keyword_argument; 151, subscript; 152, identifier:scatter; 153, identifier:pre_times; 154, subscript; 155, subscript; 156, identifier:set_title; 157, string; 158, subscript; 159, identifier:set_xlabel; 160, string; 161, subscript; 162, identifier:autoscale; 163, keyword_argument; 164, keyword_argument; 165, subscript; 166, identifier:autoscale; 167, keyword_argument; 168, keyword_argument; 169, identifier:plt; 170, identifier:setp; 171, call; 172, keyword_argument; 173, identifier:_finalise_figure; 174, argument_list; 175, subscript; 176, subscript; 177, identifier:i; 178, call; 179, identifier:key; 180, lambda; 181, identifier:x; 182, integer:0; 183, identifier:x; 184, identifier:info; 185, identifier:x; 186, integer:1; 187, identifier:x; 188, identifier:info; 189, identifier:plt; 190, identifier:subplots; 191, integer:1; 192, integer:2; 193, keyword_argument; 194, keyword_argument; 195, identifier:axes; 196, identifier:ravel; 197, identifier:len; 198, argument_list; 199, identifier:i; 200, integer:0; 201, expression_statement; 202, identifier:i; 203, binary_operator:len(times) - 1; 204, expression_statement; 205, identifier:axes; 206, integer:0; 207, identifier:mags; 208, slice; 209, identifier:axes; 210, integer:0; 211, string_content:Pre-event times; 212, identifier:axes; 213, integer:0; 214, string_content:Magnitude; 215, identifier:axes; 216, integer:0; 217, string_content:Time (Minutes); 218, attribute; 219, argument_list; 220, identifier:rotation; 221, integer:30; 222, identifier:axes; 223, integer:1; 224, identifier:mags; 225, slice; 226, identifier:axes; 227, integer:1; 228, string_content:Post-event times; 229, identifier:axes; 230, integer:1; 231, string_content:Time (Minutes); 232, identifier:axes; 233, integer:0; 234, identifier:enable; 235, True; 236, identifier:tight; 237, True; 238, identifier:axes; 239, integer:1; 240, identifier:enable; 241, True; 242, identifier:tight; 243, True; 244, attribute; 245, argument_list; 246, identifier:rotation; 247, integer:30; 248, keyword_argument; 249, dictionary_splat; 250, identifier:times; 251, identifier:i; 252, identifier:mags; 253, identifier:i; 254, identifier:range; 255, argument_list; 256, lambda_parameters; 257, subscript; 258, identifier:sharey; 259, True; 260, identifier:figsize; 261, identifier:size; 262, identifier:times; 263, call; 264, call; 265, integer:1; 266, call; 267, integer:1; 268, attribute; 269, identifier:get_majorticklabels; 270, unary_operator; 271, attribute; 272, identifier:get_majorticklabels; 273, identifier:fig; 274, identifier:fig; 275, identifier:kwargs; 276, call; 277, identifier:tup; 278, identifier:tup; 279, integer:0; 280, attribute; 281, argument_list; 282, identifier:len; 283, argument_list; 284, attribute; 285, argument_list; 286, subscript; 287, identifier:xaxis; 288, integer:1; 289, subscript; 290, identifier:xaxis; 291, identifier:len; 292, argument_list; 293, identifier:pre_times; 294, identifier:append; 295, binary_operator:(times[i] - times[i - 1]) / 60; 296, identifier:times; 297, identifier:post_times; 298, identifier:append; 299, binary_operator:(times[i + 1] - times[i]) / 60; 300, identifier:axes; 301, integer:0; 302, identifier:axes; 303, integer:1; 304, identifier:times; 305, parenthesized_expression; 306, integer:60; 307, parenthesized_expression; 308, integer:60; 309, binary_operator:times[i] - times[i - 1]; 310, binary_operator:times[i + 1] - times[i]; 311, subscript; 312, subscript; 313, subscript; 314, subscript; 315, identifier:times; 316, identifier:i; 317, identifier:times; 318, binary_operator:i - 1; 319, identifier:times; 320, binary_operator:i + 1; 321, identifier:times; 322, identifier:i; 323, identifier:i; 324, integer:1; 325, identifier:i; 326, integer:1
code: def interev_mag(times, mags, size=(10.5, 7.5), **kwargs):
      """
      Plot inter-event times against magnitude.
  
      :type times: list
      :param times: list of the detection times, must be sorted the same as mags
      :type mags: list
      :param mags: list of magnitudes
      :type size: tuple
      :param size: Size of figure in inches.
  
      :returns: :class:`matplotlib.figure.Figure`
  
      .. rubric:: Example
  
      >>> from obspy.clients.fdsn import Client
      >>> from obspy import UTCDateTime
      >>> from eqcorrscan.utils.plotting import interev_mag
      >>> client = Client('IRIS')
      >>> t1 = UTCDateTime('2012-03-26T00:00:00')
      >>> t2 = t1 + (3 * 86400)
      >>> catalog = client.get_events(starttime=t1, endtime=t2, minmagnitude=3)
      >>> magnitudes = [event.preferred_magnitude().mag for event in catalog]
      >>> times = [event.preferred_origin().time for event in catalog]
      >>> interev_mag(times, magnitudes) # doctest: +SKIP
  
      .. plot::
  
          from obspy.clients.fdsn import Client
          from obspy import UTCDateTime
          from eqcorrscan.utils.plotting import interev_mag
          client = Client('IRIS')
          t1 = UTCDateTime('2012-03-26T00:00:00')
          t2 = t1 + (3 * 86400)
          catalog = client.get_events(starttime=t1, endtime=t2, minmagnitude=3)
          magnitudes = [event.preferred_magnitude().mag for event in catalog]
          times = [event.preferred_origin().time for event in catalog]
          interev_mag(times, magnitudes)
      """
      import matplotlib.pyplot as plt
      info = [(times[i], mags[i]) for i in range(len(times))]
      info.sort(key=lambda tup: tup[0])
      times = [x[0] for x in info]
      mags = [x[1] for x in info]
      # Make two subplots next to each other of time before and time after
      fig, axes = plt.subplots(1, 2, sharey=True, figsize=size)
      axes = axes.ravel()
      pre_times = []
      post_times = []
      for i in range(len(times)):
          if i > 0:
              pre_times.append((times[i] - times[i - 1]) / 60)
          if i < len(times) - 1:
              post_times.append((times[i + 1] - times[i]) / 60)
      axes[0].scatter(pre_times, mags[1:])
      axes[0].set_title('Pre-event times')
      axes[0].set_ylabel('Magnitude')
      axes[0].set_xlabel('Time (Minutes)')
      plt.setp(axes[0].xaxis.get_majorticklabels(), rotation=30)
      axes[1].scatter(pre_times, mags[:-1])
      axes[1].set_title('Post-event times')
      axes[1].set_xlabel('Time (Minutes)')
      axes[0].autoscale(enable=True, tight=True)
      axes[1].autoscale(enable=True, tight=True)
      plt.setp(axes[1].xaxis.get_majorticklabels(), rotation=30)
      fig = _finalise_figure(fig=fig, **kwargs)  # pragma: no cover
      return fig