What I want:

  1. In the 1st plot: ignore the first rows of a data file
  2. In the 2nd plot: show the graph in a limited y-range (0:3.5)

What I have: regarding 1) no working solution and the error: Package PGF Math Error: Could not parse input '5*10^8' as a floating point number, sorry. The unreadable part was near '*10^8'.. ...domain={1.21678749999999990E7}:{5*10^8}] t

for 2) Dimension too large. \end{axis} I can get rid of this error message if I leave out the "ymax"-option, but I want to plot the data in this y-range only. The scale would be too big otherwise and it seems as if I would need to limit the read-in-data as well?

What I tried For 1) I tried 1,2, and 3.

All boils down to restrict x to domain=<start>:<end> but I seem to have some syntax error still?

edit: aw. that's what happens when you mix up x and y axis. (so the approaches mentioned in the code might actually work.)

\pgfplotstableread[col sep=space]{% 
3.00000000000000000E5   2.01770954045417160E-2
1.21678749999999990E7   6.53843084045015650E-1
2.02879999999999990E7   9.34720793380564530E-1
4.02759999999999960E7   9.30338681065119390E-1
6.02639999999999980E7   5.36647938885778150E-1
7.08826249999999900E7   3.04803797644972230E-1
8.02519999999999990E7   9.33974811366713990E-2
9.02460000000000130E7   1.32431168793329920E-1
1.00240000000000000E8   3.54244688254279620E-1
1.10233999999999990E8   5.56734207627991040E-1
1.20228000000000000E8   7.89192714838333220E-1
1.30222000000000020E8   9.96160077734732850E-1
1.40216000000000010E8   1.23583766580312780E0
1.50209999999999980E8   1.46258850812222540E0
1.60204000000000010E8   1.69992167155321970E0
1.70198000000000000E8   1.95123830485607840E0
1.80192000000000020E8   2.22623159795794030E0
1.90185999999999990E8   2.50805235677870940E0
2.00180000000000020E8   2.77839855801785560E0
2.03303124999999960E8   2.90467776154555810E0
2.18294124999999980E8   3.50255734987308460E0
2.30786625000000000E8   4.00071696691821100E0
2.49525374999999980E8   5.01045376157417350E0
2.97621500000000030E8   1.00071861346771680E1
3.17609500000000010E8   1.52144470748861930E1
3.51339250000000060E8   5.11315529444377590E1
3.65705625000000010E8   5.64439690499664070E2
3.68204124999999970E8   6.46670133059780470E2
3.73825749999999960E8   1.28837192967264010E2
3.94438375000000010E8   3.14628301208824810E1
4.60024000000000030E8   1.02387484129196960E1
5.00000000000000000E8   7.99406030727084270E0   
\pgfplotstableread[col sep=space]{% 
3.00000000000000000E5   1.00404355551509550E-7
1.54925000000000020E6   1.36824493432681880E-7
1.21678749999999990E7   1.43033737315883540E-7
2.02879999999999990E7   1.44632961165595790E-7
4.02759999999999960E7   1.39406177062964030E-7
6.02639999999999980E7   1.36487519163806460E-7
7.02580000000000120E7   1.35779692017299450E-7
8.02519999999999990E7   1.34017193632160230E-7
9.02460000000000130E7   1.31860433859521780E-7
1.00240000000000000E8   1.29120627287948260E-7
1.10233999999999990E8   1.24526497804674220E-7
1.20228000000000000E8   1.19549452160883240E-7
1.30222000000000020E8   1.13171593160961900E-7
1.40216000000000010E8   1.04087039044147180E-7
1.50209999999999980E8   9.25617857567434400E-8
1.50834625000000020E8   9.17023108625545370E-8
1.60204000000000010E8   7.94831770727646350E-8
1.70198000000000000E8   6.30136807536853190E-8
1.80192000000000020E8   4.66571908839113720E-8
1.90185999999999990E8   2.73887584234017910E-8
2.00180000000000020E8   7.56282270904724550E-9
2.03303124999999960E8   1.44238994938850200E-9
2.18294124999999980E8   nan
2.30786625000000000E8   nan
2.49525374999999980E8   nan
2.97621500000000030E8   nan
3.17609500000000010E8   nan
3.51339250000000060E8   nan
3.65705625000000010E8   nan
3.68204124999999970E8   nan
3.73825749999999960E8   nan
3.94438375000000010E8   nan
4.60024000000000030E8   nan
5.00000000000000000E8   nan 
        no markers,
%           ymin=0,
%           ymax=3.5*10^-7,
%           xmin=.1*10^8, 
%           xmax={5*10^8},
%       \addplot +[restrict x to domain=0.1*10^8:5*10^8] table [col sep=space] from \data;                      % does not work
%       \addplot +[restrict x to domain={0.1*10^8}:{5*10^8}] table [col sep=space] from \data;                  % does not work
%       \addplot +[restrict x to domain={1.21678749999999990E7}:{5*10^8}] table [col sep=space] from \data;     % does not work
%       \addplot +[restrict expr to domain={1.21678749999999990E7}:{5*10^8}] table [col sep=space] from \data;  % does not work
        \addplot +[] table [col sep=space]from \datav; % with the notch at the beginning
    \end{tikzpicture} \hspace{5mm} \begin{tikzpicture}
    no markers,
    \addplot +[] table [col sep=space]from \datat;      

Looking like this:

example picture of code above

(still with the notch at Fig. 1 and with error message of Dimension too large for Fig. 2)


1 Answer 1


For the first graph, the problem is just the wrong number notation (change from 5*10^8 to the correct 5e8 and so on):

    no markers,
   \addplot+  table [col sep=space] from \datav;

Notice that if you are reading the data from a file directly in the addplot table command, you can use skip first n=1 to just ignore the first line, but this does not work if a table is loaded with pgfplotstableread.

What does work is @Fritz's solution so you can add in the preamble

% Style to select only points from #1 to #2 (inclusive)
\pgfplotsset{select coords between index/.style 2 args={
    x filter/.code={

and then

\addplot+  table [col sep=space, select coords between index={1}{1000}] from \datav;

(which gives a slightly better output in my opinion).

For the second one, the problem is that the point at value around 600, when scaled to the new yrange, exceed the dimension capacity of TeX. There may be better ways, but a quick and fast option is

    no markers,
\addplot  +[restrict y to domain=0:3.5] table [col sep=space] from \datat;      

which results in (with the first graph the simple way, limiting axes):


or (with Fritz's select coords between index):

second output

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .