0

Using \def\FileName{Zone B Stuff.txt},

\addplot[black,mark=square*,mark options={scale=1,fill=white,black}] table[x=Year,y=MedianCap] {\FileName}; fails..

Of course, using \addplot[black,mark=square*,mark options={scale=1,fill=white,black}] table[x=Year,y=MedianCap] {Zone B Stuff.txt}; works OK

How can I import data using \FileName? Thanks.

Here's the working example:

\documentclass[letterpaper]{article}
\usepackage{pgfplots,amsmath}
\pgfplotsset{compat=1.18}
\pagestyle{empty}

\def\FileName{Zone B Stuff.txt}
\def\Zone{Zone B\hspace{1.4mm}}

\begin{document}
\begin{tikzpicture}[baseline]

\node[fill=white,rectangle] (title) at (3.5,6.5) {\bfseries\FileName};

\begin{axis}[scaled ticks=false,unbounded coords=jump,
axis y line*=left,
axis x line*=bottom,
ymax=100,ymin=0,
xmin=2000,
xmax=2025,
ytick={0,25,50,75,100},
xtick={2000,2005,2010,2015,2020,2025},
minor x tick num=4,
minor y tick num=4,
grid=major,
ylabel={\large\bfseries Median Capacity (\%)},
xlabel={\large\bfseries Year},
legend style={at={(0.2,0.55)},anchor=west}
      ]

\addplot[black,mark=square*,mark options={scale=1,fill=white,black}] table[x=Year,y=MedianCap] {\FileName};
\addlegendentry{\bfseries \Zone Capacity};

\end{axis}
\end{tikzpicture}%

\end{document} 
user39678
  • 73
  • 7

0 Answers0