# plot many lines

I have generated pstricks-code from data:

\psset{unit=10cm}
\begin{pspicture}(0,0)(1,1)
\psline(0.22029880495812262,0.23497192515414284)(0.21975600857793104,0.23394684903842253)
\psline(0.2584529413334904,0.22000887379324077)(0.2551267563022901,0.21319288260584074)
\psline(0.2584529413334904,0.22000887379324077)(0.2591309918937222,0.22175303315432685)
\psline(0.3833672951833354,0.13344349076667328)(0.38201653304384925,0.13337464237083807)
\psline(0.574041875405995,0.2843744740747551)(0.5783130600368138,0.2848105139150266)
\psline(0.574041875405995,0.2843744740747551)(0.5708758597984268,0.28412967977846876)
\psline(0.5611001859745068,0.3016936705374795)(0.5624740836974276,0.30102813604442846)
\psline(0.5611001859745068,0.3016936705374795)(0.5599451864639463,0.30213736019950443)
\psline(0.33774570434501133,0.15330242805342456)(0.336387823564517,0.15383026575480516)
\psline(0.22830905580127048,0.252222273221032)(0.22817380162135673,0.25358394149416136)
% about 9000 more lines
\end{pspicture}


But LaTeX gives me an out of memory error.

Is there any better (less memory consuming) way to create this plot of about 9000 small lines (two coordinates each)?

The data can be downloaded here: https://paste.ee/p/q08ru (Format: x0,y0 x1,y1)

• Looks like an exported code from a Programm. Nobody needs so many decimals ... can you provide the complete data for a download? – user2478 Dec 15 '17 at 22:06
• paste.ee/p/q08ru Format: x0,y0 x1,y1 – user2033412 Dec 15 '17 at 22:12
• are you trying to plot a city map with pstricks? Maybe this is not the right place to ask this... but how did you get all those points? – Alex Recuenco Dec 16 '17 at 9:11
• (by the way, judging by how small the distance between points are, I think you can get away trying to plot the points themselves instead of the lines, and it will be visually very similar) – Alex Recuenco Dec 16 '17 at 9:12
• Yes, indeed. It's a very small part of a map. Plotting the lines like Herbert did works if the lines are very short but makes visible breaks to the roads when they are longer. – user2033412 Dec 16 '17 at 11:19

The lines are really short and it makes more sense to use the plot style dots:

    \documentclass[pstricks,border=10pt]{standalone}
\usepackage{pst-plot}
\begin{document}

\psset{unit=10}
\begin{pspicture}(-0.1,-0.1)(1.1,1.1)
\psaxes[Dx=0.2,Dy=0.2,labelFontSize=\scriptstyle]{->}(1,1.05)
\listplot[plotstyle=dots,dotsize=1pt]{\Data}
\end{pspicture}
\end{document}


If you still need the lines then you have to increase the TeX input buffer or to create a solution on PostScript level.

And here a solution which needs the data file without a comma between the coordinates (can simply be replaced by a space).

\documentclass[pstricks,border=10pt]{standalone}
\usepackage{pst-plot}
\begin{document}

\psset{unit=10}
\makeatletter
\begin{pspicture}(-0.1,-0.1)(1,1)
\psaxes[Dx=0.2,Dy=0.2,labelFontSize=\scriptstyle]{->}(0.8,0.8)
\pscustom{
\code{
[ (pstricks.data) run ] /Points exch def  % save data
Points length 4 div cvi /No exch def      % No of lines
1 setlinewidth
1 0 0 setrgbcolor
0 4 No {
/iNo exch def
Points iNo 4  getinterval aload pop
\tx@ScreenCoor
4 2 roll \tx@ScreenCoor
moveto lineto stroke
} for
}
}
\end{pspicture}
\end{document}


• I already increased the input buffer to TeXLives maximum -- still no success. :-( – user2033412 Dec 16 '17 at 8:33
• for the above example it works with the default setting. – user2478 Dec 16 '17 at 9:13
• I mean I tried to plot the lines (not the dots) -- and it didn't work (even after increasing the memory limit). – user2033412 Dec 16 '17 at 12:04
• I edited my answer with a solution on PostScript level. – user2478 Dec 17 '17 at 20:06
• I just tried it, the file now has the format x1 y1 x2 y2 (as you mentioned), but with the default toolchain (latex, dvips, ps2pdf) I get a ghostscript error. Is there any hidden pitfall? – user2033412 Dec 17 '17 at 21:49