LASP 1.0
Library for Acoustic Signal Processing
Loading...
Searching...
No Matches
lasp.plot.bar.BarScene Class Reference

Graphhics Scene for plotting bars. More...

Inheritance diagram for lasp.plot.bar.BarScene:
Collaboration diagram for lasp.plot.bar.BarScene:

Public Member Functions

 __init__ (self, parent, xvals, G, ylim=(0, 1), grid=True, xlabel=None, ylabel=None, title=None, colors=DEFAULT_COLORS, size=(1200, 600), legend=None, legendpos=None)
 Initialize a bar scene.
 
 saveAsBitmap (self, fn)
 Save bar image as a jpg file.
 
 saveAsPdf (self, fn, force=False)
 Save bar image as a eps file.
 
 getBarGroupMidPos (self, n)
 Returns the mid x position below each bar group.
 
 getBarRect (self, n, g, yval)
 Returns a bar QRectF.
 
 addLine (self, x1, y1, x2, y2, pen=QPen(), brush=QBrush())
 
 createRect (self, x, y, Lx, Ly, pen=QPen(), brush=QBrush())
 Create a rectangle somewhere, in relative coordinates originating from the lower left position.
 
 set_ydata (self, newydata)
 

Public Attributes

 ylim
 
 N
 
 G
 
 bgs
 
 size
 
 xsize
 
 ysize
 
 colors
 
 yticks
 

Detailed Description

Graphhics Scene for plotting bars.

Definition at line 46 of file bar.py.

Constructor & Destructor Documentation

◆ __init__()

lasp.plot.bar.BarScene.__init__ (   self,
  parent,
  xvals,
  G,
  ylim = (0, 1),
  grid = True,
  xlabel = None,
  ylabel = None,
  title = None,
  colors = DEFAULT_COLORS,
  size = (1200, 600),
  legend = None,
  legendpos = None 
)

Initialize a bar scene.

Args: xvals: labels and x positions of the bars G: Number of bars per x value ylim: y limits of the figure xlabel: label below x-axis ylabel: label on left side of the y-axis title: figure title colors: color cycler size: size of the plot in pixels legend: list of legend strings to show. legendpos: position of legend w.r.t. default position, in pixels

Definition at line 51 of file bar.py.

Member Function Documentation

◆ addLine()

lasp.plot.bar.BarScene.addLine (   self,
  x1,
  y1,
  x2,
  y2,
  pen = QPen(),
  brush = QBrush() 
)

Definition at line 328 of file bar.py.

◆ createRect()

lasp.plot.bar.BarScene.createRect (   self,
  x,
  y,
  Lx,
  Ly,
  pen = QPen(),
  brush = QBrush() 
)

Create a rectangle somewhere, in relative coordinates originating from the lower left position.

Definition at line 335 of file bar.py.

◆ getBarGroupMidPos()

lasp.plot.bar.BarScene.getBarGroupMidPos (   self,
  n 
)

Returns the mid x position below each bar group.

Definition at line 286 of file bar.py.

◆ getBarRect()

lasp.plot.bar.BarScene.getBarRect (   self,
  n,
  g,
  yval 
)

Returns a bar QRectF.

Args: n: Bar index (i.e. corresponding to a certain frequency band) g: Bar group (i.e. corresponding to a certain quantity) yval: Height of bar, 1 for full lenght, 0 for no length

Returns: QRectF corresponding to the bar at the right place in the scene

Definition at line 299 of file bar.py.

◆ saveAsBitmap()

lasp.plot.bar.BarScene.saveAsBitmap (   self,
  fn 
)

Save bar image as a jpg file.

Overwrites a file already existing in filesystem.

https://stackoverflow.com/questions/7451183/how-to-create-image-file\ -from-qgraphicsscene-qgraphicsview#11642517

Args: fn: Filename Returns: True on success

Definition at line 223 of file bar.py.

◆ saveAsPdf()

lasp.plot.bar.BarScene.saveAsPdf (   self,
  fn,
  force = False 
)

Save bar image as a eps file.

Args: fn: Filename force: if True, overwrites an existing file. If false, raises a RuntimeError if file already exists.

Definition at line 257 of file bar.py.

◆ set_ydata()

lasp.plot.bar.BarScene.set_ydata (   self,
  newydata 
)

Definition at line 352 of file bar.py.

Member Data Documentation

◆ bgs

lasp.plot.bar.BarScene.bgs

Definition at line 82 of file bar.py.

◆ colors

lasp.plot.bar.BarScene.colors

Definition at line 90 of file bar.py.

◆ G

lasp.plot.bar.BarScene.G

Definition at line 81 of file bar.py.

◆ N

lasp.plot.bar.BarScene.N

Definition at line 80 of file bar.py.

◆ size

lasp.plot.bar.BarScene.size

Definition at line 84 of file bar.py.

◆ xsize

lasp.plot.bar.BarScene.xsize

Definition at line 87 of file bar.py.

◆ ylim

lasp.plot.bar.BarScene.ylim

Definition at line 78 of file bar.py.

◆ ysize

lasp.plot.bar.BarScene.ysize

Definition at line 88 of file bar.py.

◆ yticks

lasp.plot.bar.BarScene.yticks

Definition at line 102 of file bar.py.


The documentation for this class was generated from the following file: