12. mpl — jscatter 0.8.2 documentation

# 12. mpl

This is a rudimentary interface to matplotlib to use dataArrays easier. The standard way to use matplotlib is full available without using this module..

The intention is to allow fast/easy plotting (one command to plot) with some convenience function in relation to dataArrays and in a non blocking mode of matplotlib. E.g. to include automatically the value of an attribute (qq in example) in the legend:

    fig[0].Plot(mydataArray, legend='sqr=$qq',sy=[2,3,-1],li=0)
    # dataList
    fig[0].Plot(mydataList , legend='sqr=$qq',sy=[2,3,-1],li=0)

With somehow shorter form to determine the marker (sy=symbol) and line (li) and allow plotting in one line. Matplotlib is quite slow (and looks for me ugly). For 2D plotting use xmgrace. For 3D plotting this will give some simple plot options (planned).

- The new methods introduced all start with a big Letter to allow still the access of the original methods.
- By indexing subplots can be accessed as figure[i] which is figure.axes[i].
- Same for axes with lines figure[0][i] is figure.axes[0].lines[i].

Example 1:

    import jscatter as js
    import numpy as np
    i5=js.dL(js.examples.datapath+'/iqt_1hho.dat')
    p=js.mplot()
    p[0].Plot(i5,sy=[-1,0.4,-1],li=1,legend='Q= $q')
    p[0].Yaxis(scale='l')
    p[0].Title('intermediate scattering function')
    p[0].Legend(x=1.13,y=1) # x,y in relative units of the plot
    p[0].Yaxis(label='I(Q,t)/I(Q,0)',min=0.01)
    p[0].Xaxis(label='Q / 1/nm',max=120)

Example 2 ( same as js.mpl.test() ):

    import jscatter as js
    import numpy as np
    from matplotlib import pyplot
    # use this
    #fig=pyplot.figure(FigureClass=js.mpl.Figure)
    # or
    fig=js.mplot()
    fig.Multi(2,1)
    fig[0].SetView(0.1,0.25,0.8,0.9)
    fig[1].SetView(0.1,0.09,0.8,0.23)
    q=js.loglist(0.01,5,100)
    aa=js.dL()
    for pp in range(5):
        aa.append(js.dA(np.c_[q,-pp*np.sin(q),0.2*np.cos(5*q)].T))
        aa[-1].qq=pp
    bb=js.dA(np.c_[q,q**2].T)
    bb.qq=123
    for pp in range(5):
        fig[0].Plot(aa[pp].X,-1*aa[pp].Y,legend='some stufff',sy=[1,(pp+1)/10.],li=0)

    fig[0].Plot(aa, legend='qq = $qq', sy=[-1, 0.4, -1, ''], li=0, markeredgewidth=1)
    for pp in range(5):
        fig[1].Plot(aa[-1].X/5+pp,pp*aa[-1].Y,legend='q=%.1f' %pp,sy=0,li=-1,markeredgewidth =1)
    fig[1].Plot(bb,legend='sqr=$qq ',sy=2,li=2)
    fig[0].Title('test')
    fig[0].Legend(x=1.3,y=1)
    fig[1].Legend(x=1.3,y=1)
    fig[0].Yaxis(label='y-axis')
    fig[1].Yaxis(label='something else')
    fig[0].tick_params(labelbottom=False)
    fig[1].Xaxis(label='x-axis')

Some short hints for matplotlib Dont use the pyplot interface as it hides how most things work and e.g. how to access lines later. See THIS . After fitting the errorplot can be accessed as `data.errplot`.

    fig=js.mplot()                         # access figure properties from fig
    fig.axes[0]                            # access to axes properties
    fig.axes[0].lines[0]                   # access to lines properties in axes 0
    fig.axes[0].lines[1].set_color('b')    # change color
    fig.axes[0].legend(...)                # set legend
    data.errplot.axes[0].set_yscale('log') # set log scale in errplot
    # for more read matplotlib documentation

## 12.1. Plot

`mplot`([width, height]) | Open matplotlib figure in interactive mode with mplot.jsFigure and mplot.jspaperAxes.
`surface`(x, y, z[, xdim, levels, colorMap, …]) | Surface plot of x,y,z, data
`scatter3d`(x[, y, z, pointsize, color]) | Scatter plot of x,y,z data points.
`contourImage`(x[, y, z, levels, fontsize, …]) | Image with contour lines of 3D dataArrays or image array.
`showColors`() | Get a list of the colormaps in matplotlib.
`test`([keepopen]) | A small test for mpl module making a plot.

## 12.2. Figures

class `jscatter.mpl.` `jsFigure`(*args, **kwargs)

  Create figure with Axes as jspaperAxes projection.

  Examples

      import jscatter as js
      import numpy as np
      i5=js.dL(js.examples.datapath+'/iqt_1hho.dat')
      p=js.mplot()
      p[0].Plot(i5,sy=[-1,0.4,-1],li=1,legend='Q= $q')
      p[0].Yaxis(scale='l')
      p[0].Title('intermediate scattering function')
      p[0].Legend(x=1.13,y=1) # x,y in relative units of the plot
      p[0].Yaxis(label='I(Q,t)/I(Q,0)',min=0.01)
      p[0].Xaxis(label='Q / 1/nm',max=120)

`jsFigure.Multi`(n, m) | Creates multiple subplots on grid n,m.
`jsFigure.Addsubplot`([bbox]) | Add a subplot in the foreground.
`jsFigure.Plot`(*args, **kwargs) |
`jsFigure.Clear`() | Clear content of all axes
`jsFigure.Save`(filename[, format, dpi]) | Save with filename
`jsFigure.is_open`() | Is the figure window still open.
`jsFigure.Exit`() |

## 12.3. Axes

class `jscatter.mpl.` `jspaperAxes`(*args, **kwargs)

  An Axes that should look like typical paper layout.

`jspaperAxes.Plot`(*datasets, **kwargs) | Plot dataArrays/dataList or array in matplotlib axes.
`jspaperAxes.Yaxis`([min, max, label, scale, …]) | Set xaxis
`jspaperAxes.Xaxis`([min, max, label, scale, …]) | Set xaxis
`jspaperAxes.Legend`(**kwargs) | Show/update legend.
`jspaperAxes.Title`(title[, size]) | set Axes title
`jspaperAxes.Subtitle`(subtitle[, size]) | Append subtitle to title
`jspaperAxes.SetView`([xmin, ymin, xmax, ymax]) | This sets the bounding box of the axes.
`jspaperAxes.Clear`() | Clear content of this axes.
`jspaperAxes.Text`(string, x, y, **kwargs) |
`jspaperAxes.Arrow`([x1, y1, x2, y2, …]) | Plot an arrow or line.

This is a rudimentary interface to matplotlib to use dataArrays easier. The standard way to use matplotlib is full available without using this module..

The intention is to allow fast/easy plotting (one command to plot) with some convenience function in relation to dataArrays and in a non blocking mode of matplotlib. E.g. to include automatically the value of an attribute (qq in example) in the legend:

    fig[0].Plot(mydataArray, legend='sqr=$qq',sy=[2,3,-1],li=0)
    # dataList
    fig[0].Plot(mydataList , legend='sqr=$qq',sy=[2,3,-1],li=0)

With somehow shorter form to determine the marker (sy=symbol) and line (li) and allow plotting in one line. Matplotlib is quite slow (and looks for me ugly). For 2D plotting use xmgrace. For 3D plotting this will give some simple plot options (planned).

- The new methods introduced all start with a big Letter to allow still the access of the original methods.
- By indexing subplots can be accessed as figure[i] which is figure.axes[i].
- Same for axes with lines figure[0][i] is figure.axes[0].lines[i].

Example 1:

    import jscatter as js
    import numpy as np
    i5=js.dL(js.examples.datapath+'/iqt_1hho.dat')
    p=js.mplot()
    p[0].Plot(i5,sy=[-1,0.4,-1],li=1,legend='Q= $q')
    p[0].Yaxis(scale='l')
    p[0].Title('intermediate scattering function')
    p[0].Legend(x=1.13,y=1) # x,y in relative units of the plot
    p[0].Yaxis(label='I(Q,t)/I(Q,0)',min=0.01)
    p[0].Xaxis(label='Q / 1/nm',max=120)

Example 2 ( same as js.mpl.test() ):

    import jscatter as js
    import numpy as np
    from matplotlib import pyplot
    # use this
    #fig=pyplot.figure(FigureClass=js.mpl.Figure)
    # or
    fig=js.mplot()
    fig.Multi(2,1)
    fig[0].SetView(0.1,0.25,0.8,0.9)
    fig[1].SetView(0.1,0.09,0.8,0.23)
    q=js.loglist(0.01,5,100)
    aa=js.dL()
    for pp in range(5):
        aa.append(js.dA(np.c_[q,-pp*np.sin(q),0.2*np.cos(5*q)].T))
        aa[-1].qq=pp
    bb=js.dA(np.c_[q,q**2].T)
    bb.qq=123
    for pp in range(5):
        fig[0].Plot(aa[pp].X,-1*aa[pp].Y,legend='some stufff',sy=[1,(pp+1)/10.],li=0)

    fig[0].Plot(aa, legend='qq = $qq', sy=[-1, 0.4, -1, ''], li=0, markeredgewidth=1)
    for pp in range(5):
        fig[1].Plot(aa[-1].X/5+pp,pp*aa[-1].Y,legend='q=%.1f' %pp,sy=0,li=-1,markeredgewidth =1)
    fig[1].Plot(bb,legend='sqr=$qq ',sy=2,li=2)
    fig[0].Title('test')
    fig[0].Legend(x=1.3,y=1)
    fig[1].Legend(x=1.3,y=1)
    fig[0].Yaxis(label='y-axis')
    fig[1].Yaxis(label='something else')
    fig[0].tick_params(labelbottom=False)
    fig[1].Xaxis(label='x-axis')

Some short hints for matplotlib Dont use the pyplot interface as it hides how most things work and e.g. how to access lines later. See THIS . After fitting the errorplot can be accessed as `data.errplot`.

    fig=js.mplot()                         # access figure properties from fig
    fig.axes[0]                            # access to axes properties
    fig.axes[0].lines[0]                   # access to lines properties in axes 0
    fig.axes[0].lines[1].set_color('b')    # change color
    fig.axes[0].legend(...)                # set legend
    data.errplot.axes[0].set_yscale('log') # set log scale in errplot
    # for more read matplotlib documentation

`jscatter.mpl.` `contourImage`(x, y=None, z=None, levels=8, fontsize=10, colorMap='jet', lineMap=None, title=None, axis=None)

  Image with contour lines of 3D dataArrays or image array.

  Parameters: | x,y,z : arrays x,y,z coordinates for z display in x,y location. If x is image array this is used. If x is dataArray we plot like x,y,z=x.X,x.Z,x.Y as dataArray use always .Y as value in X,Z coordinates. levels : in, sequence of values Number of contour lines between min and max or sequence of specific values. colorMap : string Get a colormap instance from name. Standard mpl colormap name (see showColors). lineMap : string Label color Colormap name as in colorMap, otherwise as cs in in Axes.clabel * if None, the color of each label matches the color of the corresponding contour * if one string color, e.g., colors = ‘r’ or colors = ‘red’, all labels will be plotted in this color * if a tuple of matplotlib color args (string, float, rgb, etc), different labels will be plotted in different colors in the order specified fontsize : int, default 10 Size of line labels in pixel title : None, string Title of the plot. May be set by fig.axes[0].set_title(‘title’) axis : None, ‘pixel’ If coordinates should be forced to pixel. Returns ——- figure

  Examples

  - Create log scale image for maskedArray (sasImage)

        import jscatter as js
        import numpy as np
        # sets negative values to zero
        calibration = js.sas.sasImage(js.examples.datapath+'/calibration.tiff')
        fig=js.mpl.contourImage(calibration,title='Calibration lin scale')
        fig=js.mpl.contourImage(np.ma.log(calibration))
        #
        # change labels and title
        ax=fig.axes[0]
        ax.set_xlabel('qx ')
        ax.set_ylabel('qy')
        ax.set_title(r'Calibration log scaled')
        js.mpl.pyplot.show(block=False)

        import jscatter as js
        import numpy as np
        x,z=np.mgrid[-5:5:0.25,-5:5:0.25]
        xyz=js.dA(np.c_[x.flatten(),z.flatten(),0.3*np.sin(x*z/np.pi).flatten()+0.01*np.random.randn(len(x.flatten())),0.01*np.ones_like(x).flatten() ].T)
        # set columns where to find X,Y,Z )
        xyz.setColumnIndex(ix=0,iy=2,iz=1)
        # determine yourself what is x,y,z
        js.mpl.contourImage(xyz.X,xyz.Z,xyz.Y)
        # determined automatically from values in setColumnIndex above
        js.mpl.contourImage(xyz)

        # remove each 3rd point that we have missing points
        x,z=js.formel.randomPointsInCube(1500,0,2)*10-5
        xyz=js.dA(np.c_[x.flatten(),z.flatten(),0.3*np.sin(x*z/np.pi).flatten()+0.01*np.random.randn(len(x.flatten()))].T)
        xyz.setColumnIndex(ix=0,iy=2,iz=1)
        js.mpl.contourImage(xyz)

`jscatter.mpl.` `gf` = 20

  gracefactor to get same scaling as in grace set to 10

class `jscatter.mpl.` `jsFigure`(*args, **kwargs)

  Bases: `matplotlib.figure.Figure`

  Create figure with Axes as jspaperAxes projection.

  Examples

      import jscatter as js
      import numpy as np
      i5=js.dL(js.examples.datapath+'/iqt_1hho.dat')
      p=js.mplot()
      p[0].Plot(i5,sy=[-1,0.4,-1],li=1,legend='Q= $q')
      p[0].Yaxis(scale='l')
      p[0].Title('intermediate scattering function')
      p[0].Legend(x=1.13,y=1) # x,y in relative units of the plot
      p[0].Yaxis(label='I(Q,t)/I(Q,0)',min=0.01)
      p[0].Xaxis(label='Q / 1/nm',max=120)

  `Addsubplot`(bbox=(0.2, 0.2, 0.6, 0.6), *args, **kwargs)

    Add a subplot in the foreground.

    Parameters: | bbox : rect [left, bottom, width, height] Bounding box position and size.

  `Clear`()

    Clear content of all axes

    to clear axes use fig.clear()

  `Close`()

    Close the figure

  `Exit`()
  `Legend`(*args, **kwargs)
  `Line`(*args, **kwargs)
  `Multi`(n, m)

    Creates multiple subplots on grid n,m. with projection “jspaperAxes”.

    Subplots can be accesses as fig[i]

  `Plot`(*args, **kwargs)
  `Save`(filename, format=None, dpi=None, **kwargs)

    Save with filename

  `Subtitle`(*args, **kwargs)
  `Text`(*args, **kwargs)
  `Title`(*args, **kwargs)
  `Xaxis`(*args, **kwargs)
  `Yaxis`(*args, **kwargs)
  `is_open`()

    Is the figure window still open.

  `plot`(*args, **kwargs)

class `jscatter.mpl.` `jspaperAxes`(*args, **kwargs)

  Bases: `matplotlib.axes._axes.Axes`

  An Axes that should look like typical paper layout.

  `Arrow`(x1=None, y1=None, x2=None, y2=None, linewidth=None, arrow=None)

    Plot an arrow or line.

    Parameters: | x1,y1,x2,y2 : float Start/end coordinates in box units [0..1]. linewidth : float Linewidth arrow : int or [‘-‘,’->’,’<-‘,’<->’] Type of arrow. If int it selects from [‘-‘,’->’,’<-‘,’<->’]

  `Clear`()

    Clear content of this axes.

  `Legend`(**kwargs)

    Show/update legend.

    Parameters: | charsize, fontsize : int, default 12 Font size of labels labelspacing : int , default =12 Spacing of labels loc : int [0..10] default 1 ‘upper right’ Location specifier - ‘best’ 0, ‘upper right’ 1, ‘upper left’ 2, ‘lower left’ 3, ‘lower right’ 4,‘center left’ 6, x,y : float [0..1] Determines if both given loc and sets position in axes coordinates. Sets bbox_to_anchor=(x,y) kwargs : kwargs of axes.legend Any given kwarg overrides the previous

  `Plot`(*datasets, **kwargs)

    Plot dataArrays/dataList or array in matplotlib axes.

    Parameters are passed to matplotlib.axes.Axes.plot

    Parameters: | datasets : dataArray/dataList or 1D arrays Datasets to plot. Can be several dataArray/dataList (with .X, .Y and .eY) or 1D arrays (a[1,:],b[2,:]), but dont mix it. If dataArray/dataList has .eY errors a errorbars are plotted. If format strings are found only the first is used. symbol, line override this. Only a single line for 1D arrays is allowed. symbol,sy : int, list of float [symbol,size,color,fillcolor,fillpattern] as [1,1,1,-1]; single integer to chose symbol eg symbol=3; symbol=0 switches off negative increments from last symbol => see Line2D.filled_markers size => size in pixel color => int in sequence = wbgrcmyk fillcolor=None see color fillpattern=None 0 empty, 1 full, ….test it line,li : int, list of float or Line object [linestyle,linewidth,color] as [1,1,’‘]; negative increments single integer to chose linestyle line=1; line=0 switches of linestyle int ‘-‘,’–’,’-.’,’:’ linewidth float increasing thickness color see symbol color errorbar,er : int or list of float or Errorbar object [color,size] as [1,1]; no increment, no repeat color int see symbol color, non-integer syncs to symbol color size float default 1.0 ; smaller is 0.5 legend,le : string determines legend for all datasets string replacement: attr name prepended by ‘$’ (eg. ‘$par’) is replaced by value str(par1.flatten()[0]) if possible. $(par) for not unique names errorbar,er : float errorbar thickness, zero is no errorbar

  `Resetlast`()
  `SetView`(xmin=None, ymin=None, xmax=None, ymax=None)

    This sets the bounding box of the axes.

    Parameters: | xmin,xmax,ymin,ymax : float view range

  `Subtitle`(subtitle, size=None, **kwargs)

    Append subtitle to title

  `Text`(string, x, y, **kwargs)
  `Title`(title, size=None, **kwargs)

    set Axes title

  `Xaxis`(min=None, max=None, label=None, scale=None, size=None, charsize=None, tick=None, ticklabel=None, **kwargs)

    Set xaxis

    Parameters: | label : string Label scale : ‘log’, ‘normal’ Scale min,max : float Set min and max of scale size : int Pixelsize of label

  `Yaxis`(min=None, max=None, label=None, scale=None, size=None, charsize=None, tick=None, ticklabel=None, **kwargs)

    Set xaxis

    Parameters: | label : string Label scale : ‘log’, ‘normal’ Scale min,max : float Set min and max size : int Pixelsize of label

  `linlog`(*args, **kwargs)
  `loglin`(*args, **kwargs)
  `name` = 'paper'
  `plot`(*datasets, **kwargs)

    Plot dataArrays/dataList or array in matplotlib axes.

    Parameters are passed to matplotlib.axes.Axes.plot

    Parameters: | datasets : dataArray/dataList or 1D arrays Datasets to plot. Can be several dataArray/dataList (with .X, .Y and .eY) or 1D arrays (a[1,:],b[2,:]), but dont mix it. If dataArray/dataList has .eY errors a errorbars are plotted. If format strings are found only the first is used. symbol, line override this. Only a single line for 1D arrays is allowed. symbol,sy : int, list of float [symbol,size,color,fillcolor,fillpattern] as [1,1,1,-1]; single integer to chose symbol eg symbol=3; symbol=0 switches off negative increments from last symbol => see Line2D.filled_markers size => size in pixel color => int in sequence = wbgrcmyk fillcolor=None see color fillpattern=None 0 empty, 1 full, ….test it line,li : int, list of float or Line object [linestyle,linewidth,color] as [1,1,’‘]; negative increments single integer to chose linestyle line=1; line=0 switches of linestyle int ‘-‘,’–’,’-.’,’:’ linewidth float increasing thickness color see symbol color errorbar,er : int or list of float or Errorbar object [color,size] as [1,1]; no increment, no repeat color int see symbol color, non-integer syncs to symbol color size float default 1.0 ; smaller is 0.5 legend,le : string determines legend for all datasets string replacement: attr name prepended by ‘$’ (eg. ‘$par’) is replaced by value str(par1.flatten()[0]) if possible. $(par) for not unique names errorbar,er : float errorbar thickness, zero is no errorbar

`jscatter.mpl.` `mplot`(width=None, height=None, **kwargs)

  Open matplotlib figure in interactive mode with mplot.jsFigure and mplot.jspaperAxes.

  Parameters: | width,height : float Size of plot in cm. kwargs : Keyword args of matplotlib.pyplot.figure .
  Returns: | matplotlib figure

  Notes

  - By indexing as the axes subplots can be accessed as figure[i] which is figure.axes[i].
  - Same for axes with lines figure[0][i] is figure.axes[0].lines[i].
  - Some methods with similar behaviour as in grace are defined (big letter commands)
  - matplotlib methods are still available (small letters commands)

`jscatter.mpl.` `regrid`(x, y, z, xdim=None)

  Make a meshgrid from XYZ data columns.

  Parameters: | x,y,z : array like Array like data should be quadratic or rectangular. xdim : None, shape of first x dimension If None the number of unique values in x is used as first dimension
  Returns: | 2dim arrays for x,y,z

`jscatter.mpl.` `scatter3d`(x, y=None, z=None, pointsize=3, color='k')

  Scatter plot of x,y,z data points.

  Parameters: | x,y,z : arrays Data to plot. If x.shape is Nx3 these points are used. pointsize : float Size of points color : string Colors for points
  Returns: | figure

  Examples

      # ellipsoid with grid build by mgrid
      import jscatter as js
      import numpy as np
      # cubic grid points
      ig=js.formel.randomPointsInCube(200)
      js.mpl.scatter3d(ig.T)

`jscatter.mpl.` `show`(**kwargs)

  Same as pyplot.show(**kwargs)

  Parameters: | kwargs : args Passed to pyplot.show added by block=False

`jscatter.mpl.` `showColors`()

  Get a list of the colormaps in matplotlib.

  Ignore the ones that end with ‘_r’ because these are simply reversed versions of ones that don’t end with ‘_r’

  Colormaps Names
    Accent, Accent_r, Blues, Blues_r, BrBG, BrBG_r, BuGn, BuGn_r, BuPu, BuPu_r, CMRmap, CMRmap_r, Dark2, Dark2_r, GnBu, GnBu_r, Greens, Greens_r, Greys, Greys_r, OrRd, OrRd_r, Oranges, Oranges_r, PRGn, PRGn_r, Paired, Paired_r, Pastel1, Pastel1_r, Pastel2, Pastel2_r, PiYG, PiYG_r, PuBu, PuBuGn, PuBuGn_r, PuBu_r, PuOr, PuOr_r, PuRd, PuRd_r, Purples, Purples_r, RdBu, RdBu_r, RdGy, RdGy_r, RdPu, RdPu_r, RdYlBu, RdYlBu_r, RdYlGn, RdYlGn_r, Reds, Reds_r, Set1, Set1_r, Set2, Set2_r, Set3, Set3_r, Spectral, Spectral_r, Vega10, Vega10_r, Vega20, Vega20_r, Vega20b, Vega20b_r, Vega20c, Vega20c_r, Wistia, Wistia_r, YlGn, YlGnBu, YlGnBu_r, YlGn_r, YlOrBr, YlOrBr_r, YlOrRd, YlOrRd_r, afmhot, afmhot_r, autumn, autumn_r, binary, binary_r, bone, bone_r, brg, brg_r, bwr, bwr_r, cool, cool_r, coolwarm, coolwarm_r, copper, copper_r, cubehelix, cubehelix_r, flag, flag_r, gist_earth, gist_earth_r, gist_gray, gist_gray_r, gist_heat, gist_heat_r, gist_ncar, gist_ncar_r, gist_rainbow, gist_rainbow_r, gist_stern, gist_stern_r, gist_yarg, gist_yarg_r, gnuplot, gnuplot2, gnuplot2_r, gnuplot_r, gray, gray_r, hot, hot_r, hsv, hsv_r, inferno, inferno_r, jet, jet_r, magma, magma_r, nipy_spectral, nipy_spectral_r, ocean, ocean_r, pink, pink_r, plasma, plasma_r, prism, prism_r, rainbow, rainbow_r, seismic, seismic_r, spectral, spectral_r, spring, spring_r, summer, summer_r, tab10, tab10_r, tab20, tab20_r, tab20b, tab20b_r, tab20c, tab20c_r, terrain, terrain_r, viridis, viridis_r, winter, winter_r

  From https://matplotlib.org/1.2.1/examples/pylab_examples/show_colormaps.html

`jscatter.mpl.` `surface`(x, y, z, xdim=None, levels=8, colorMap='jet', lineMap=None, alpha=0.7)

  Surface plot of x,y,z, data

  Parameters: | x,y,z : array Data as array xdim : integer First dimension of x levels : integer, array Levels for contour lines as number of levels or array of specific values. colorMap : string Color map name, see showColors. lineMap : string Color name for contour lines b: blue g: green r: red c: cyan m: magenta y: yellow k: black w: white alpha : float [0,1], default 0.7 Transparency of surface
  Returns: | figure

  Examples

      import jscatter as js
      import numpy as np
      R=8
      N=50
      qxy=np.mgrid[-R:R:N*1j, -R:R:N*1j].reshape(2,-1).T
      qxyz=np.c_[qxy,np.zeros(qxy.shape[0])]
      sclattice= js.lattice.scLattice(2.1, 5)
      ds=[[20,1,0,0],[5,0,1,0],[5,0,0,1]]
      ffs=js.sf.orientedLatticeStructureFactor(qxyz,sclattice,orientation=[1,0,0],domainsize=ds,rmsd=0.1,hklmax=2)
      fig=js.mpl.surface(qxyz[:,0],qxyz[:,1],ffs[3].array)

`jscatter.mpl.` `test`(keepopen=True)

  A small test for mpl module making a plot.

  Examples

      import jscatter as js
      import numpy as np
      from matplotlib import pyplot
      # use this
      #fig=pyplot.figure(FigureClass=js.mpl.Figure)
      # or
      fig=js.mplot()
      fig.Multi(2,1)
      fig[0].SetView(0.1,0.25,0.8,0.9)
      fig[1].SetView(0.1,0.09,0.8,0.23)
      q=js.loglist(0.01,5,100)
      aa=js.dL()
      for pp in range(5):
          aa.append(js.dA(np.c_[q,-pp*np.sin(q),0.2*np.cos(5*q)].T))
          aa[-1].qq=pp
      bb=js.dA(np.c_[q,q**2].T)
      bb.qq=123
      for pp in range(5):
          fig[0].Plot(aa[pp].X,-1*aa[pp].Y,legend='some stufff',sy=[1,(pp+1)/10.],li=0)

      fig[0].Plot(aa, legend='qq = $qq', sy=[-1, 0.4, -1, ''], li=0, markeredgewidth=1)
      for pp in range(5):
          fig[1].Plot(aa[-1].X/5+pp,pp*aa[-1].Y,legend='q=%.1f' %pp,sy=0,li=-1,markeredgewidth =1)
      fig[1].Plot(bb,legend='sqr=$qq ',sy=2,li=2)
      fig[0].Title('test')
      fig[0].Legend(x=1.3,y=1)
      fig[1].Legend(x=1.3,y=1)
      fig[0].Yaxis(label='y-axis')
      fig[1].Yaxis(label='something else')
      fig[0].tick_params(labelbottom=False)
      fig[1].Xaxis(label='x-axis')