docs: def histplot(infile="", data=(), outfile="",
               xlab='x', binsize=False, norm=1,
               fmt='svg', save_plots=True, interactive=False):
      """
      makes histograms for data
  
      Parameters
      ----------
      infile : str, default ""
          input file name
          format: single variable
      data : list-like, default ()
          list/array of values to plot if infile is not provided
      outfile : str, default ""
          name for plot, if not provided defaults to hist.FMT
      xlab : str, default 'x'
          label for x axis
      binsize : int, default False
          desired binsize.  if not specified, an appropriate binsize will be calculated.
      norm : int, default 1
          1: norm, 0: don't norm, -1: show normed and non-normed axes
      fmt : str, default "svg"
          format for figures, ["svg", "jpg", "pdf", "png"]
      save_plots : bool, default True
          if True, create and save all requested plots
      interactive : bool, default False
          interactively plot and display
          (this is best used on the command line only)
      """
      # set outfile name
      if outfile:
          fmt = ""
      else:
          outfile = 'hist.'+fmt
      # read in data from infile or use data argument
      if os.path.exists(infile):
          D = np.loadtxt(infile)
      else:
          D = np.array(data)
      try:
          if not len(D):
              print('-W- No data found')
              return False, []
      except ValueError:
          pass
      fig = pmagplotlib.plot_init(1, 8, 7)
      try:
          len(D)
      except TypeError:
          D = np.array([D])
      if len(D) < 5:
          print("-W- Not enough points to plot histogram ({} point(s) provided, 5 required)".format(len(D)))
          return False, []
  
      # if binsize not provided, calculate reasonable binsize
      if not binsize:
          binsize = int(np.around(1 + 3.22 * np.log(len(D))))
      binsize = int(binsize)
      Nbins = int(len(D) / binsize)
      ax = fig.add_subplot(111)
      if norm == 1:
          print('normalizing')
          n, bins, patches = ax.hist(
              D, bins=Nbins, facecolor='#D3D3D3', histtype='stepfilled', color='black', density=True)
          ax.set_ylabel('Frequency')
      elif norm == 0:
          print('not normalizing')
          n, bins, patches = ax.hist(
              D, bins=Nbins, facecolor='#D3D3D3', histtype='stepfilled', color='black', density=False)
          ax.set_ylabel('Number')
      elif norm == -1:
          #print('trying twin')
          n, bins, patches = ax.hist(
              D, bins=Nbins, facecolor='#D3D3D3', histtype='stepfilled', color='black', density=True)
          ax.set_ylabel('Frequency')
          ax2 = ax.twinx()
          n, bins, patches = ax2.hist(
              D, bins=Nbins, facecolor='#D3D3D3', histtype='stepfilled', color='black', density=False)
          ax2.set_ylabel('Number', rotation=-90)
      plt.axis([D.min(), D.max(), 0, n.max()+.1*n.max()])
      ax.set_xlabel(xlab)
      name = 'N = ' + str(len(D))
      plt.title(name)
      if interactive:
          pmagplotlib.draw_figs({1: 'hist'})
          p = input('s[a]ve to save plot, [q]uit to exit without saving  ')
          if p != 'a':
              return True, []
          plt.savefig(outfile)
          print('plot saved in ', outfile)
          return True, [outfile]
      if pmagplotlib.isServer:
          pmagplotlib.add_borders({'hist': 1}, {'hist': 'Intensity Histogram'})
      if save_plots:
          plt.savefig(outfile)
          print('plot saved in ', outfile)
          return True, [outfile]