fix graph and white background added

This commit is contained in:
Ayzen
2026-10-15 14:46:06 +03:00
parent 5102ed751c
commit 9a9b8ce5c7
35 changed files with 730 additions and 463 deletions
+3 -9
View File
@@ -8,7 +8,6 @@ preview into off-screen PNG files, letting us persist a graph for every config.
from __future__ import annotations
import logging
from pathlib import Path
import numpy as np
@@ -16,13 +15,9 @@ import pyqtgraph as pg
from PyQt6.QtCore import QRectF
from pyqtgraph.exporters import ImageExporter
from python_app.gui.controllers.renderers.common import CAPTURED_TRACE_PEN
from python_app.models.dataset_model import TraceData
from python_app.gui.theme import PLOT_BACKGROUND
logger = logging.getLogger(__name__)
_MAGNITUDE_PEN = pg.mkPen("#4cc9f0", width=1.8)
_PHASE_PEN = pg.mkPen("#f48c06", width=1.8)
_EXPORT_SIZE = (1400, 520)
@@ -43,7 +38,6 @@ def export_trace_png(
phase_deg = np.degrees(np.angle(samples))
layout = pg.GraphicsLayoutWidget(show=False, size=_EXPORT_SIZE)
layout.setBackground(PLOT_BACKGROUND)
try:
layout.ci.addLabel(title, row=0, col=0, colspan=2)
@@ -51,13 +45,13 @@ def export_trace_png(
magnitude_plot.showGrid(x=True, y=True, alpha=0.2)
magnitude_plot.setLabel("bottom", "Frequency", units="Hz")
magnitude_plot.setLabel("left", "Magnitude", units="dB")
magnitude_plot.plot(trace.frequency_hz, magnitude_db, pen=_MAGNITUDE_PEN)
magnitude_plot.plot(trace.frequency_hz, magnitude_db, pen=CAPTURED_TRACE_PEN)
phase_plot = layout.ci.addPlot(row=1, col=1)
phase_plot.showGrid(x=True, y=True, alpha=0.2)
phase_plot.setLabel("bottom", "Frequency", units="Hz")
phase_plot.setLabel("left", "Phase", units="deg")
phase_plot.plot(trace.frequency_hz, phase_deg, pen=_PHASE_PEN)
phase_plot.plot(trace.frequency_hz, phase_deg, pen=CAPTURED_TRACE_PEN)
# An off-screen widget never receives a resizeEvent, so its central
# GraphicsLayout keeps its small preferred size and both plots would be