修改SDR色准深色异常、修改保存结果深色模式异常
This commit is contained in:
@@ -9,15 +9,10 @@ from typing import TYPE_CHECKING
|
||||
|
||||
from matplotlib.patches import Rectangle
|
||||
from matplotlib.lines import Line2D
|
||||
import matplotlib.colors as mcolors
|
||||
import numpy as np
|
||||
|
||||
from matplotlib.ticker import MultipleLocator, AutoMinorLocator
|
||||
from app.views.modern_styles import get_theme_palette
|
||||
|
||||
from app.plots.gamut_background import get_cie1976_background
|
||||
from app.tests.color_accuracy import get_accuracy_color_standards
|
||||
from app.pq.color_patch_map import get_patch_color
|
||||
from app.pq.color_patch_map import get_patch_color_from_xy
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pqAutomationApp import PQAutomationApp
|
||||
@@ -68,13 +63,13 @@ def _xy_to_uv(x: float, y: float):
|
||||
return 0.0, 0.0
|
||||
return (4.0 * x) / denom, (9.0 * y) / denom
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 子图:左侧 Calman 风格面板
|
||||
# ============================================================
|
||||
|
||||
def _draw_left_panel(ax, color_patches, delta_e_values, font_scale=1.0, dark_mode=False):
|
||||
"""左侧仅保留大条形图"""
|
||||
|
||||
ax.clear()
|
||||
|
||||
n = len(color_patches)
|
||||
@@ -85,37 +80,43 @@ def _draw_left_panel(ax, color_patches, delta_e_values, font_scale=1.0, dark_mod
|
||||
y_pos = list(range(n))
|
||||
bar_colors = [_COLOR_MAP.get(name, "#888888") for name in color_patches]
|
||||
|
||||
edgecolor = "#F3F5F7" if dark_mode else "#202020"
|
||||
text_color = "#F3F5F7" if dark_mode else "#111111"
|
||||
bg_color = "#0F1115" if dark_mode else "#FFFFFF"
|
||||
|
||||
ax.barh(
|
||||
y_pos,
|
||||
delta_e_values,
|
||||
height=0.72,
|
||||
color=bar_colors,
|
||||
edgecolor="#202020",
|
||||
edgecolor=edgecolor,
|
||||
linewidth=0.5,
|
||||
zorder=3,
|
||||
)
|
||||
|
||||
text_color = "#F3F5F7" if dark_mode else "#111111"
|
||||
bg_color = "#0F1115" if dark_mode else "#FFFFFF"
|
||||
spine_color = "#8C8F94" if dark_mode else "#9A9A9A"
|
||||
|
||||
ax.set_yticks(y_pos)
|
||||
ax.set_yticklabels(color_patches, fontsize=max(5, 7 * font_scale), color=text_color)
|
||||
ax.invert_yaxis()
|
||||
|
||||
x_max = max(15.0, max(delta_e_values) * 1.15)
|
||||
ax.set_xlim(0, x_max)
|
||||
ax.tick_params(axis="x", labelsize=max(6, 8 * font_scale), colors=text_color)
|
||||
ax.grid(axis="x", linestyle="-", linewidth=0.6, alpha=0.3, zorder=0)
|
||||
ax.grid(axis="y", linestyle=":", linewidth=0.35, alpha=0.15, zorder=0)
|
||||
|
||||
ax.tick_params(
|
||||
axis="x",
|
||||
labelsize=max(6, 8 * font_scale),
|
||||
colors=text_color
|
||||
)
|
||||
|
||||
ax.tick_params(
|
||||
axis="y",
|
||||
labelsize=max(5, 7 * font_scale),
|
||||
colors=text_color
|
||||
)
|
||||
|
||||
ax.set_facecolor(bg_color)
|
||||
for spine in ax.spines.values():
|
||||
spine.set_color(spine_color)
|
||||
spine.set_linewidth(0.9)
|
||||
|
||||
|
||||
|
||||
# 自动 minor tick
|
||||
ax.xaxis.set_minor_locator(AutoMinorLocator(2))
|
||||
|
||||
|
||||
# ============================================================
|
||||
@@ -126,7 +127,7 @@ def _draw_uv_diagram(ax, color_patches, measurements, standards, font_scale=1.0,
|
||||
"""绘制 CIE 1976 u'v' 上的色准对比。"""
|
||||
ax.clear()
|
||||
try:
|
||||
bg, bbox = get_cie1976_background()
|
||||
bg, bbox = get_cie1976_background(mode="dark" if dark_mode else "light")
|
||||
if bg.shape[-1] == 4:
|
||||
bg = bg[:, :, :3]
|
||||
xmin, xmax, ymin, ymax = bbox
|
||||
@@ -154,6 +155,11 @@ def _draw_uv_diagram(ax, color_patches, measurements, standards, font_scale=1.0,
|
||||
|
||||
ax.set_facecolor("#000" if dark_mode else "#FFFFFF")
|
||||
ax.set_aspect("equal", adjustable="box")
|
||||
ax.xaxis.set_major_locator(MultipleLocator(0.1))
|
||||
ax.yaxis.set_major_locator(MultipleLocator(0.1))
|
||||
|
||||
ax.xaxis.set_minor_locator(MultipleLocator(0.02))
|
||||
ax.yaxis.set_minor_locator(MultipleLocator(0.02))
|
||||
|
||||
ax.set_title(
|
||||
"CIE 1976 u'v'",
|
||||
@@ -309,7 +315,7 @@ def _draw_result_judgement(ax, accuracy_data, font_scale=1.0, dark_mode=False):
|
||||
# ============================================================
|
||||
|
||||
def plot_accuracy(self: "PQAutomationApp", accuracy_data, test_type):
|
||||
"""绘制色准测试结果 - Calman 风格(色块 + CIE 1976 u'v' + 统计)。"""
|
||||
"""绘制色准测试结果"""
|
||||
palette = get_theme_palette()
|
||||
try:
|
||||
from app.views.theme_manager import is_dark
|
||||
|
||||
Reference in New Issue
Block a user