In the following LogLogPlot
, I'd like to have the Dynamic[pt]
color change from Purple
to Blue
- when above the Purple
horizontal line - and change from Purple
to Red
when below the line. So far, Directive[Purple]
initializes the color:
DynamicModule[{pt = {-9., -55.2}}, LocatorPane[Dynamic[pt],
LogLogPlot[1/x^3, {x, 10^-12, 10^8},
Epilog -> {
{PointSize[Large], Directive[Purple],
Point[Dynamic[{First[pt], 1/Exp[First@pt]^3 // Log}]]},
{Inset[Style["\[LongDash]\[LongDash]\[LongDash]\[LongDash]", Bold, Purple], {-9,
26.5}]}
},
AxesOrigin -> {0, 0}, AspectRatio -> 1, ImageSize -> {520, 400}]
]]
However, attempts at using If[...] logic, or the following Which[...] intervals logic, returns the Error message: "Which is not a graphics directive":
Directive[Which[
Dynamic[pt] == {Interval[{.0001, 10^-12}],
Interval[{10^-9, 10^33}]}, Blue,
Dynamic[pt] == {Interval[{.0001, .001}], Interval[{10^-11, 10^-9}]},
Purple,
Dynamic[pt] == {Interval[{.001, 10^8}], Interval[{10^-11, 10^-25}]},
Red]]
Also, perhaps I should post this as a separate question, but it would be really tight if the Locator
itself were constrained to the x
axis.