Hi again!
Yeah I can really see how the scintillation helps you seeing the square at lower contrasts. I think your latest addition was really good. The {{"MouseUp", 1} :> .... event means that the primary button (button number 1) is the one we are interested in. I added it because simply "MouseUp" wouldn't work for me. Your new code works however, so I don't know what I was doing before.
What I'd like to do is have a little editing menu (delete a graph point for now).
From a statistical standpoint, it would probably be better to remove outliers on a predefined basis. But from a dynamic interactivity perspective your suggestion is golden and I couldn't help myself from looking into it.
User kglr on StackExchange made me realize something that I never would have know. In this thread, he/she shows ListPlot can plot buttons. So what I did was I set each button so that it would contain a function to remove the plot point in question and recalculate the fitted equations, the result was this (also attached):
drawGraphs[] := Module[{},
{xxr, xxg, xxb} = FitColorPoints[];
CreateDocument[{
Dynamic@Panel@Show[
Plot[{xxr, xxg, xxb}, {x, 0, 1},
PlotStyle -> {Red, Green, Blue}],
ListPlot[
MapIndexed[
Button[Tooltip@#,
{vals = Delete[vals, #2],
{xxr, xxg, xxb} = FitColorPoints[]}] &, vals, {2}],
PlotStyle -> {Red, Green, Blue}],
PlotRange -> {{0, 1}, {0, 1}}, AxesOrigin -> {0, 0},
GridLines -> Automatic,
AxesLabel -> {"Saturation", "Response"}],
Dynamic@
Style[Grid[{{"RED", "GREEN", "BLUE"},
MatrixForm /@ (Sort /@ vals), {xxr, xxg, xxb}}, Frame -> All],
ShowStringCharacters -> False]
}
]
]
I needed to move your valsr, valsg, and valsb into a single list, vals, to accomplish this though! Using MapIndex, the second argument of the mapping is the position of the value in the list vals. There are lots of ways to expand on this if one is interested, the thread on stackexchange I linked to earlier shows them highlighting the plot points using the epilog option. By expanding on that code, a user could highlight a number of different plotpoints and delete them by pressing the delete key.
You talked about having a small editing menu, was there any more functionality you where thinking about rather than just deleting the outlying points?
Patrik
Attachments: