Open BeastyBlacksmith opened 4 years ago
We did not expose that API yet, so currently a workaround would be some variant of
using PGFPlotsX
Plot(PGFPlotsX.dictify(["mark" => "*", c]), PGFPlotsX.Coordinates(1:3,2:4))
I can see two solutions to this:
push!
method, and a constructor from an iterable,@pgf
macro process interpolation ($c
)We should do (1) in any case IMO, (2) would be a nice sugar in addition.
that wouldn't allow me to pass colors as a RGB type though, am I right?
no, use color = ...
for that. that needs no extra tricks.
I mean something like
c = RGB(1.0,0.0,0.0)
PGFPlotsX.@pgf PGFPlotsX.Plot(
{
mark = "*",
"mark options" = "{ color = $c }",
},
PGFPlotsX.Coordinates(1:3,2:4))
( I try to get the markers in a different color than the line )
You don't need a string, so you don't need to interpolate:
using PGFPlotsX, Colors
c = RGB(1.0,0.0,0.0)
PGFPlotsX.@pgf PGFPlotsX.Plot(
{
mark = "*",
"mark options" = { color = c },
},
PGFPlotsX.Coordinates(1:3,2:4))
We could do like BenchmarkTools and implement interpolation in the macro.
I see, that would be useful to construct things like
using PGFPlotsX
opt = :mark
PGFPlotsX.@pgf { $opt = "*" }
That would be nice.
However, thinking about this, most of the standalone options one would want to interpolate are shortcuts, eg red
is color = red
, for which we have convenient syntax.
The following does not use the escaped value of
c
:It reports
Is there an alternative way to do this?