Figure size can be changed using GUI, added immature possibility for plot presets. Figures now have right font. PlotOptions becomes dataclass. Show sensitivity values in measurement info box.
This commit is contained in:
parent
43e11b53ba
commit
6b4e5fba9b
@ -21,7 +21,8 @@ include_directories(
|
|||||||
# )
|
# )
|
||||||
|
|
||||||
set(ui_files ui_apsrtsettings ui_mainwindow ui_figure ui_about
|
set(ui_files ui_apsrtsettings ui_mainwindow ui_figure ui_about
|
||||||
ui_apswidget ui_revtimewidget ui_slmwidget ui_daqwidget ui_apssettings)
|
ui_apswidget ui_revtimewidget ui_slmwidget ui_daqwidget ui_apssettings
|
||||||
|
ui_figuredialog)
|
||||||
foreach(fn ${ui_files})
|
foreach(fn ${ui_files})
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT "${fn}.py"
|
OUTPUT "${fn}.py"
|
||||||
|
@ -14,7 +14,6 @@ from PySide.QtGui import (
|
|||||||
QGraphicsTextItem, QPainter, QImage, QPrinter
|
QGraphicsTextItem, QPainter, QImage, QPrinter
|
||||||
)
|
)
|
||||||
|
|
||||||
# from PySide.QtOpenGL import
|
|
||||||
from PySide.QtCore import Qt, QRectF, QLineF, QSize, QRect, QPointF, QSizeF
|
from PySide.QtCore import Qt, QRectF, QLineF, QSize, QRect, QPointF, QSizeF
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import os
|
import os
|
||||||
@ -37,6 +36,10 @@ DEFAULT_COLORS = [ASCEEColors.blue, ASCEEColors.green, Qt.red, Qt.cyan,
|
|||||||
Qt.darkYellow,
|
Qt.darkYellow,
|
||||||
Qt.darkMagenta]
|
Qt.darkMagenta]
|
||||||
|
|
||||||
|
def graphicsTextItem(label):
|
||||||
|
item = QGraphicsTextItem(label)
|
||||||
|
item.setFont(Branding.figureFont())
|
||||||
|
return item
|
||||||
|
|
||||||
class BarScene(QGraphicsScene):
|
class BarScene(QGraphicsScene):
|
||||||
"""
|
"""
|
||||||
@ -112,7 +115,7 @@ class BarScene(QGraphicsScene):
|
|||||||
range_ = ylim[1]-ylim[0]
|
range_ = ylim[1]-ylim[0]
|
||||||
ytickval = i/(nyticks-1)*range_ + ylim[0]
|
ytickval = i/(nyticks-1)*range_ + ylim[0]
|
||||||
yticklabel = f'{ytickval:.0f}'
|
yticklabel = f'{ytickval:.0f}'
|
||||||
txt = QGraphicsTextItem(yticklabel)
|
txt =graphicsTextItem(yticklabel)
|
||||||
txtwidth = txt.boundingRect().width()
|
txtwidth = txt.boundingRect().width()
|
||||||
txtmaxwidth = max(txtmaxwidth, txtwidth)
|
txtmaxwidth = max(txtmaxwidth, txtwidth)
|
||||||
txt.setPos(leftoffset-10-txtwidth,
|
txt.setPos(leftoffset-10-txtwidth,
|
||||||
@ -138,7 +141,7 @@ class BarScene(QGraphicsScene):
|
|||||||
xticklabels = []
|
xticklabels = []
|
||||||
for n in range(N):
|
for n in range(N):
|
||||||
xticklabel = f'{xvals[n]}'
|
xticklabel = f'{xvals[n]}'
|
||||||
txt = QGraphicsTextItem(xticklabel)
|
txt = graphicsTextItem(xticklabel)
|
||||||
txtxpos = self.getBarGroupMidPos(n)-12
|
txtxpos = self.getBarGroupMidPos(n)-12
|
||||||
txt.setPos(txtxpos,
|
txt.setPos(txtxpos,
|
||||||
self.ysize-bottomoffset+xticklabeloffset)
|
self.ysize-bottomoffset+xticklabeloffset)
|
||||||
@ -148,7 +151,7 @@ class BarScene(QGraphicsScene):
|
|||||||
|
|
||||||
# Set xlabel
|
# Set xlabel
|
||||||
if xlabel is not None:
|
if xlabel is not None:
|
||||||
xlabel = QGraphicsTextItem(xlabel)
|
xlabel = graphicsTextItem(xlabel)
|
||||||
width = xlabel.boundingRect().width()
|
width = xlabel.boundingRect().width()
|
||||||
txtxpos = xsize/2-width/2
|
txtxpos = xsize/2-width/2
|
||||||
txtypos = ysize - xlabelbottomoffset
|
txtypos = ysize - xlabelbottomoffset
|
||||||
@ -157,7 +160,7 @@ class BarScene(QGraphicsScene):
|
|||||||
|
|
||||||
# # Set ylabel
|
# # Set ylabel
|
||||||
if ylabel is not None:
|
if ylabel is not None:
|
||||||
ylabel = QGraphicsTextItem(ylabel)
|
ylabel = graphicsTextItem(ylabel)
|
||||||
ylabel.setPos(ylabelleftoffset,
|
ylabel.setPos(ylabelleftoffset,
|
||||||
(ysize-topoffset-bottomoffset)/2+topoffset)
|
(ysize-topoffset-bottomoffset)/2+topoffset)
|
||||||
ylabel.rotate(-90)
|
ylabel.rotate(-90)
|
||||||
@ -165,7 +168,7 @@ class BarScene(QGraphicsScene):
|
|||||||
|
|
||||||
# Set title
|
# Set title
|
||||||
if title is not None:
|
if title is not None:
|
||||||
title = QGraphicsTextItem(title)
|
title = graphicsTextItem(title)
|
||||||
width = xlabel.boundingRect().width()
|
width = xlabel.boundingRect().width()
|
||||||
txtxpos = self.xsize/2-width/2
|
txtxpos = self.xsize/2-width/2
|
||||||
txtypos = (1-.998)*self.ysize
|
txtypos = (1-.998)*self.ysize
|
||||||
@ -200,7 +203,7 @@ class BarScene(QGraphicsScene):
|
|||||||
legrect = self.createRect(*pos, Lxlegrect, Lylegrect)
|
legrect = self.createRect(*pos, Lxlegrect, Lylegrect)
|
||||||
|
|
||||||
legrect.setBrush(QBrush(color))
|
legrect.setBrush(QBrush(color))
|
||||||
legtxt = QGraphicsTextItem(leglabel)
|
legtxt = graphicsTextItem(leglabel)
|
||||||
maxlegtxtwidth = max(maxlegtxtwidth,
|
maxlegtxtwidth = max(maxlegtxtwidth,
|
||||||
legtxt.boundingRect().width())
|
legtxt.boundingRect().width())
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ import numpy as np
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def close():
|
def close():
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
plt.close('all')
|
plt.close('all')
|
||||||
|
Loading…
Reference in New Issue
Block a user