1

I have the following loop in my gnuplot script to iterate over multiple files and draw one graph:

files = system("echo $(ls *.csv)")
plot for [f in files] f  using 0:2:xtic(1) with lp ,\
for [f in files] f using 0:2:2 with labels font ',8' offset 1,0.5 notitle "",\
for [f in files] f  using 0:2:3 with yerrorbars title ""

For every datapoint a linepoint, a label and a yerrorbar is drawn.

Is it possible to use the same color for corresponding linepoint, yerrorbar and label? If yes, how?

thanks!

0

1 Answer 1

0

You can use set linetype cycle ... to define after how many iterations the same patterns and colors are repeated:

files = system("echo $(ls *.csv)")

set linetype cycle words(files)

plot for [f in files] f  using 0:2:xtic(1) with lp ,\
     for [f in files] f using 0:2:2 with labels font ',8' offset 1,0.5 notitle "",\
     for [f in files] f  using 0:2:3 with yerrorbars title ""

Here is a simple example:

set linetype cycle 2
set samples 10
set key left
set style function linespoints
plot x, 2*x, 3*x, 4*x, 5*x, 6*x

The output with 4.6.5 is:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.