3

I have a following code:

\documentclass[a4paper, landscape]{article}

\usepackage{amsmath}
\usepackage{pgfplots}
\usepackage{graphicx}
\usepackage{underscore}
\usepackage{adjustbox}
\usepackage{filecontents}

\pgfplotsset{compat=1.13}

\begin{document}

\begin{adjustbox}{center, set height=\textheight}
\begin{tikzpicture}
\begin{axis}[
title={ Settings: ('1', '0') },
xlabel={ Frequency [kHz] },
ylabel={ Consumption [W] },
legend pos=outer north east,
xmajorgrids=true,
ymajorgrids=true,
grid style=dashed,
no markers,
width=24cm,
height=11cm,
cycle list name = color list
]
\addplot gnuplot [raw gnuplot] { plot 'data11200.csv' every 10};
\addplot gnuplot [raw gnuplot] { plot 'data11201.csv' every 10};
\addplot gnuplot [raw gnuplot] { plot 'data11202.csv' every 10};
\addplot gnuplot [raw gnuplot] { plot 'data11203.csv' every 10};
\addplot gnuplot [raw gnuplot] { plot 'data11204.csv' every 10};
\addplot gnuplot [raw gnuplot] { plot 'data11205.csv' every 10};
\addplot gnuplot [raw gnuplot] { plot 'data11206.csv' every 10};
\addplot gnuplot [raw gnuplot] { plot 'data11207.csv' every 10};
\addplot gnuplot [raw gnuplot] { plot 'data11208.csv' every 10};
\addplot gnuplot [raw gnuplot] { plot 'data11209.csv' every 10};
\legend{ 6,7,8,9,10,11,12,13,14,15 }
\end{axis}
\end{tikzpicture}
\end{adjustbox}
\end{document}

Where the file data11200.csv looks like this:

ind,val
1200000.0,95.77487445833333
1300000.0,94.35378141666668
1400000.0,90.58904254166667
1500000.0,88.2311345
1600000.0,86.95179183333333
1700000.0,84.05458666666667
1800000.0,83.41422775
1900000.0,83.93314775
2000000.0,83.99366095833334
2100000.0,84.14217891666667
2200000.0,82.13892612500001
2300000.0,81.391646
2400000.0,81.5418625
2500000.0,84.38398554166666

And the other files are basically the same, just with slightly different "right" values.


The problem is, that when I try to compile this code with lualatex -shell-escape, I'm getting following warnings and all I get is an empty grid without any plot.

Package pgfplots Warning: the current plot has no coordinates (or all have been filtered away)
Package pgfplots Warning: You have an axis with empty range (in direction y). Replacing it with a default range and clearing all plots.

I have literally no idea, what's the reason for the first warning.

And I can see, that the second warning tells me, that I'm supposed to give him the range of y-axis explicitly... But it can vary pretty much, so I'd like to do it automatically. I know, it's possible with table in pgfplots this way

\addplot table [x=ind, y=val, col sep=comma] {data1.csv},

but I'm not sure about gnuplot. So, is it possible?

And do you have any idea, how to solve this problem?

1

From the manual:

... the plot gnuplot command employs the external program gnuplot to compute coordinates. The resulting coordinates are written to a text file which will be plotted with plot file.

So gnuplot is only used for the calculation of coordinates from an expression. The plot itself is done by pgfplots.

To plot only each 10th coordinate from the given file data11200.csv you can use

\addplot table[each nth point=10,col sep=comma] {data11200.csv};

enter image description here

Code:

\begin{filecontents*}{data11200.csv}
ind,val
1200000.0,95.77487445833333
1300000.0,94.35378141666668
1400000.0,90.58904254166667
1500000.0,88.2311345
1600000.0,86.95179183333333
1700000.0,84.05458666666667
1800000.0,83.41422775
1900000.0,83.93314775
2000000.0,83.99366095833334
2100000.0,84.14217891666667
2200000.0,82.13892612500001
2300000.0,81.391646
2400000.0,81.5418625
2500000.0,84.38398554166666
\end{filecontents*}

\documentclass[a4paper, landscape]{article}
\usepackage{pgfplots}
\usepackage{adjustbox}
\pgfplotsset{compat=1.13}
\begin{document}
\begin{adjustbox}{center, set height=\textheight}
  \begin{tikzpicture}
    \begin{axis}[
        title={ Settings: ('1', '0') },
        xlabel={ Frequency [kHz] },
        ylabel={ Consumption [W] },
        legend pos=outer north east,
        xmajorgrids=true,
        ymajorgrids=true,
        grid style=dashed,
        width=24cm,
        height=11cm,
        cycle list name = color list
      ]
      \addplot table[each nth point=10,col sep=comma] {data11200.csv};
      \legend{6}
    \end{axis}
  \end{tikzpicture}
\end{adjustbox}
\end{document}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.