I'm doing surface plots in latex using pgfplots with a table in an external file. I would like to use a subset of that data for a 2 dimensional plot with the third dimension restricted to one value. I'm wondering if there is an easy way to do this. I tried using
\begin{axis}[
view{90,0},
restrict x to domain = 0:0.1,
]
\addplot3[mesh] table[x index=0,y index=1, z index=2] {data.dat};
\end{axis}
but it appears that at least at least two x-values must be contained in the stated x-domain, otherwise nothing is plotted. Of course, if I make the x domain larger, I get a segment of a surface plot (or mesh in this example) rather than just one edge (a 2d line plot). If I use
\begin{axis}[
]
\addplot[] table[x index=1,y index=2] {data.dat};
\end{axis}
there is, of course, nothing to tell it to restrict the column 0 values, and I get multiple lines drawn, when I only want one for a particular value in column 0.
In case it's not clear, my table looks something like:
0 0 1
0 1 2
0 2 3
1 0 1.5
1 1 2.5
1 2 3.5
2 0 2
2 1 3
2 2 4
and I want to be able to plot
0 1
1 2
2 3
by telling pgfplots to restrict the x-value to 0, rather than plotting all nine points.
Thanks in advance.
Post Details
- Posted
- 9 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/LaTeX/comme...