I'm trying to add draw commands in my tikz document, originally I had hard coded it all and made the tikz picture as follows with the draw options explicit in the string and this works fine, however I wanted to make this an argument and splice it together.
As a note I can't use VBand because I don't want the top or bottoms drawn on the areas just the sides, additionally I am drawing over multiple plots. And my drawing commands are correct too, so it's just getting the options types working
Currently works - hard coding the options
For the MWE below draw_cmds is a vector of strings containing elements like the \draw command below which currently work fine.
\draw[black!50, fill, fill opacity={0.1}] (bot1a|-top1a) rectangle (top1b|-bot1b);
So if I instead splice together [raw"\draw",@pgf{options},"coordinates, etc"] I get a vector of vectors, that's an easy work around and all of that, I can't add them to the TikzPicture because the vector of draw_cmds has each individual \draw split into [\draw,options,"rest of command"], which has types [String,PGFPlotsX.Options,String] and TikzPicture does not know what to do with the PGFPlotsX.Options. If I make it all a string, I get \drawPGFPlotsX.Options.... when I use print_tex which it of course still does not know what to do with.
The print_tex of [\draw,options,"rest of command"] is exactly what one would expect and like that to me hardcoding it (shown below), but I can't seem to figure out how to get the string to splice together so I guess I was wondering is there a way for a command like print_tex to be returned like a option_string(PGFPlotsX.Options). I think I'm just missing something obvious though.
using print_tex by specifying custom options:
\draw
[black!50, fill, fill opacity={0.1}] (bot1a|-top1a) rectangle (top1b|-bot1b);
Also FWIW this command below works in another function I have, but I'm pushing to an Axis instead of a TikzPicture@pgf push!(ax,[raw"\draw",diagonal_args,raw"(rel axis cs: 0,0) -- (rel axis cs: 1,1);"]);
Background
I'm trying to add draw commands in my tikz document, originally I had hard coded it all and made the tikz picture as follows with the draw options explicit in the string and this works fine, however I wanted to make this an argument and splice it together.
As a note I can't use VBand because I don't want the top or bottoms drawn on the areas just the sides, additionally I am drawing over multiple plots. And my drawing commands are correct too, so it's just getting the options types working
Currently works - hard coding the options
For the MWE below
draw_cmds
is a vector of strings containing elements like the\draw
command below which currently work fine.\draw[black!50, fill, fill opacity={0.1}] (bot1a|-top1a) rectangle (top1b|-bot1b);
Current Issue - customizing
\draw
optionsSo if I instead splice together [raw"\draw",@pgf{options},"coordinates, etc"] I get a vector of vectors, that's an easy work around and all of that, I can't add them to the TikzPicture because the vector of
draw_cmds
has each individual \draw split into[\draw,options,"rest of command"]
, which has types[String,PGFPlotsX.Options,String]
andTikzPicture
does not know what to do with thePGFPlotsX.Options
. If I make it all a string, I get\drawPGFPlotsX.Options....
when I useprint_tex
which it of course still does not know what to do with.The
print_tex
of[\draw,options,"rest of command"]
is exactly what one would expect and like that to me hardcoding it (shown below), but I can't seem to figure out how to get the string to splice together so I guess I was wondering is there a way for a command likeprint_tex
to be returned like a option_string(PGFPlotsX.Options). I think I'm just missing something obvious though.using print_tex by specifying custom options:
Also FWIW this command below works in another function I have, but I'm pushing to an
Axis
instead of aTikzPicture
@pgf push!(ax,[raw"\draw",diagonal_args,raw"(rel axis cs: 0,0) -- (rel axis cs: 1,1);"]);