How to draw points along a line at every 5 or 10 data point?

  • Follow


Hello all,

Since I have many points, it looks ugly if I draw my data set with 
'linespoints.'  I can go with just 'lines,' but I'd like to put 
points(markers) as well at every 5 or 10 data point.  I hope someone 
could help me do this in gnuplot.  Thank you.
0
Reply K 2/2/2010 9:25:33 PM

K. Lee wrote:
> Hello all,
> 
> Since I have many points, it looks ugly if I draw my data set with 
> 'linespoints.'  I can go with just 'lines,' but I'd like to put 
> points(markers) as well at every 5 or 10 data point.  I hope someone 
> could help me do this in gnuplot.  Thank you.

Plot the file twice, once "with lines", then again "every 5 with points".
0
Reply ISO 2/2/2010 9:53:49 PM


On 2/2/2010 4:53 PM, Hans-Bernhard Br�ker wrote:
> K. Lee wrote:
>> Hello all,
>>
>> Since I have many points, it looks ugly if I draw my data set with
>> 'linespoints.' I can go with just 'lines,' but I'd like to put
>> points(markers) as well at every 5 or 10 data point. I hope someone
>> could help me do this in gnuplot. Thank you.
>
> Plot the file twice, once "with lines", then again "every 5 with points".

Thank you for your advice.  In that case, I'm afraid my legend would be 
slightly incorrect, since it can have only either "line" or "point"; 
however, my line will have both "line" and "point" in a plot after 
drawing twice.
0
Reply K 2/3/2010 11:06:30 AM

Hi,

> Thank you for your advice.  In that case, I'm afraid my legend would be
> slightly incorrect, since it can have only either "line" or "point";
> however, my line will have both "line" and "point" in a plot after
> drawing twice.

plot "datafile" w l t 'my data', "" every 5 w p t ''

should help you with the key

Stefan
0
Reply Stefan 2/4/2010 10:16:54 AM

On 2/4/2010 5:16 AM, Stefan Nowy wrote:
> Hi,
>
>> Thank you for your advice.  In that case, I'm afraid my legend would be
>> slightly incorrect, since it can have only either "line" or "point";
>> however, my line will have both "line" and "point" in a plot after
>> drawing twice.
>
> plot "datafile" w l t 'my data', "" every 5 w p t ''
>
> should help you with the key
>
> Stefan

Thank you, but with your suggestion, I end up with a key showing only a 
line segment.  Since now I can draw a line along with points at every 5 
point, I'd like to have a key showing both line & point.  I'm not sure 
how can I do that.
0
Reply K 2/4/2010 2:47:28 PM

Am 03.02.2010 12:06, schrieb K. Lee:
> On 2/2/2010 4:53 PM, Hans-Bernhard Br�ker wrote:
>> K. Lee wrote:
>>> Hello all,
>>>
>>> Since I have many points, it looks ugly if I draw my data set with
>>> 'linespoints.' I can go with just 'lines,' but I'd like to put
>>> points(markers) as well at every 5 or 10 data point. I hope someone
>>> could help me do this in gnuplot. Thank you.
>>
>> Plot the file twice, once "with lines", then again "every 5 with points".
>
> Thank you for your advice. In that case, I'm afraid my legend would be
> slightly incorrect, since it can have only either "line" or "point";
> however, my line will have both "line" and "point" in a plot after
> drawing twice.

what about:
plot
datafile with lines not,
datafile every 5 with points not,
1/0 with linespoints t "legend"

you'll have to add some statements so that all 3 plots use the same 
color and/or pointtype, but i think it should work.

Karsten
-- 
Professur Modellierung und Simulation
Technische Universit�t Chemnitz, Fakult�t f�r Informatik
Stra�e der Nationen 62, Raum 366
Telefon: +49 371 531 - 37296
0
Reply Karsten 2/4/2010 3:42:52 PM

On 2/4/2010 10:42 AM, Karsten Hentsch wrote:
> Am 03.02.2010 12:06, schrieb K. Lee:
>> On 2/2/2010 4:53 PM, Hans-Bernhard Br�ker wrote:
>>> K. Lee wrote:
>>>> Hello all,
>>>>
>>>> Since I have many points, it looks ugly if I draw my data set with
>>>> 'linespoints.' I can go with just 'lines,' but I'd like to put
>>>> points(markers) as well at every 5 or 10 data point. I hope someone
>>>> could help me do this in gnuplot. Thank you.
>>>
>>> Plot the file twice, once "with lines", then again "every 5 with
>>> points".
>>
>> Thank you for your advice. In that case, I'm afraid my legend would be
>> slightly incorrect, since it can have only either "line" or "point";
>> however, my line will have both "line" and "point" in a plot after
>> drawing twice.
>
> what about:
> plot
> datafile with lines not,
> datafile every 5 with points not,
> 1/0 with linespoints t "legend"
>
> you'll have to add some statements so that all 3 plots use the same
> color and/or pointtype, but i think it should work.
>
> Karsten

Thank you Karsten!  That solved my problem.  Now I have a perfect graph.  :)
0
Reply K 2/4/2010 5:40:59 PM

K. Lee wrote:

> On 2/4/2010 10:42 AM, Karsten Hentsch wrote:
>> Am 03.02.2010 12:06, schrieb K. Lee:
>>> On 2/2/2010 4:53 PM, Hans-Bernhard Bröker wrote:
>>>> K. Lee wrote:
>>>>> Hello all,
>>>>>
>>>>> Since I have many points, it looks ugly if I draw my data set with
>>>>> 'linespoints.' I can go with just 'lines,' but I'd like to put
>>>>> points(markers) as well at every 5 or 10 data point. I hope someone
>>>>> could help me do this in gnuplot. Thank you.
>>>>
>>>> Plot the file twice, once "with lines", then again "every 5 with
>>>> points".
>>>
>>> Thank you for your advice. In that case, I'm afraid my legend would be
>>> slightly incorrect, since it can have only either "line" or "point";
>>> however, my line will have both "line" and "point" in a plot after
>>> drawing twice.
>>
>> what about:
>> plot
>> datafile with lines not,
>> datafile every 5 with points not,
>> 1/0 with linespoints t "legend"
>>
>> you'll have to add some statements so that all 3 plots use the same
>> color and/or pointtype, but i think it should work.
>>
>> Karsten
> 
> Thank you Karsten!  That solved my problem.  Now I have a perfect graph. 
> :)

I'm glad you found a solution.

This is just a plug for the upcoming version gnuplot 4.4,
in which there is a new line property "pointinterval" that automates
this process. So in version 4.4 you will be able to accomplish what you
want by saying

    plot datafile with linespoints pointinterval 5

Target schedule for release of 4.4 is next month, so you still have time
to try the release candidate and report problems requiring a last-minute
fix before final release :-)
0
Reply sfeam 2/4/2010 8:14:55 PM

7 Replies
477 Views

(page loaded in 0.161 seconds)

Similiar Articles:













7/24/2012 12:45:33 PM


Reply: