1

I have a single file with three columns call them x,y,z; I need to plot on the same graphic x VS y and x VS z.

How to plot two scatter plot on the same graphic using gnuplot?

EDIT I know that to plot a single function I have to write something like

plot 'file name' using 1:2

I don't konw how to plot together 1:2 and 1:3

1
  • 2
    Sorry, but have you tried anything? Commented Nov 2, 2017 at 18:34

1 Answer 1

3

If you want to plot Y and Z on the same axis with respect to x, then

plot "filename" u 1:2, "" u 1:3

If you want two different y-axes, that is, you want y on one axis and z on a secondary axis, then

set y2tics <start>,<incr>,<end>
plot "filename" u 1:2, "" u 1:3 axes x1y2

Note that y2tics lets you configure the secondary y axis; in particular, here it lets you decide the starting value, the ending vale, and the incrementation. Additionally, any command you know for y carries on for the secondary axis by using y2 (for example, to set the label or range, use y2label or y2range).

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.