Closed yakir12 closed 4 years ago
What is the tex output for it and what is the desired output?
julia> print_tex(p)
\addplot[mesh]
table[row sep={\\}, meta={meta}]
{
x y meta \\
1 0.0018755916179096221 rgb=1.0,0.0,1.0 \\
2 0.7237766789265359 rgb=0.749,0.0,0.749 \\
3 0.08896902731045286 rgb=0.502,0.0,0.502 \\
4 0.35566423509993705 rgb=0.251,0.0,0.251 \\
5 0.500985071869986 rgb=0.0,0.0,0.0 \\
}
;
The desired output is something like what this would produce (taken from example 121 in the pgfplots gallery):
\begin{tikzpicture}
\begin{axis}
\addplot[mesh,point meta=explicit]
coordinates {
(0,0) [0]
(1,0.1) [1]
(2,0.1) [2]
(3,0.3) [3]
(4,0.3) [4]
};
\end{axis}
\end{tikzpicture}
But I want to explicitly supply the colors as RGB instances. The reason I'm not using a colormap (which is what I did before) is that I now want to plot multiple such lines on the same axis, each with their own set of colors.
But I want to explicitly supply the colors as RGB instances
Okay, do you have an example of how the latex would look to do this?
I see, except one post claiming the contrary, it might be impossible to specify the color not-from-a-colormap.
If this indeed is the case, I guess I can build an indexed colormap and specify the index in the meta column of the supplied data frame. Please let me know if you believe that that is the way forward.
I'm not sure what the best way is :). What is needed is a working example of what the tex should look like and then we can discuss how that tex should be produced from PGFPlotsX.jl.
@yakir12, please don't take this the wrong way, but we generally cannot commit to providing LaTeX/pgfplots support for users of this package. As the manual emphasizes, PGFPlotsX is a thin wrapper, and pgfplots (the LaTeX package) does the heavy lifting. This package is essentially a LaTeX code generator.
That said, I usually tackle these kind of problems with combining Plot
s. Eg
using PGFPlotsX, Colors
n = 5
x = 1:n
y = rand(n)
colors = range(RGB(1, 0, 1), stop = RGB(0,0,0), length = n - 1)
@pgf Axis([Plot({ color = color, no_marks }, Table(x[i:(i+1)], y[i:(i+1)]))
for (i, color) in enumerate(colors)])
may be a starting point.
I totally understand. Initially I thought I was missing the PGFPlotsX.jl syntax to get it right, but after discovering that this isn't something people do, even from pgfplots, I gave it up. There's no point for PGFPlotsX.jl to do stuff pgfplots doesn't. So I agree. Not to mention that this is not a place to go looking for pgfplots support.
Thanks for the pointer! That's simpler than populating an indexed colormap.
Thanks for the awesome work, till next time...
I'm trying to plot a line whose segments are explicitly colored by ColorTypes.RGB. The following naive attempt does not work correctly: