Skip to content

Commit

Permalink
SF_FormulaPlotter: Make trace colors work with swapped axis
Browse files Browse the repository at this point in the history
When plotting text waves we plot them using the category axis feature
including swapping X and Y waves. But if we do that we also need to query
the opposite wave for the trace colors.

Bug present since e1854b0 (SF: Change average operation to support two
modes, 2023-04-05).
  • Loading branch information
t-b committed Mar 25, 2024
1 parent 2d6d674 commit a578cf1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Packages/MIES/MIES_SweepFormula.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -1903,7 +1903,16 @@ static Function SF_FormulaPlotter(string graph, string formula, [DFREF dfr, vari
WAVE wvY = dataInGraph[l][%WAVEY]
trace = tracesInGraph[l]

WAVE/Z traceColor = JWN_GetNumericWaveFromWaveNote(wvY, SF_META_TRACECOLOR)
info = AxisInfo(win, "left")
isCategoryAxis = (NumberByKey("ISCAT", info) == 1)

if(isCategoryAxis)
WAVE traceColorHolder = wvX
else
WAVE traceColorHolder = wvY
endif

WAVE/Z traceColor = JWN_GetNumericWaveFromWaveNote(traceColorHolder, SF_META_TRACECOLOR)
if(WaveExists(traceColor))
ASSERT(DimSize(traceColor, ROWS) == 3, "Need 3-element wave for color specification.")
ModifyGraph/W=$win rgb($trace)=(traceColor[0], traceColor[1], traceColor[2])
Expand Down

0 comments on commit a578cf1

Please sign in to comment.