4

I am trying to make a plot with values on the x axis ranging from 0 to 2 ms. I want to show a tick every .1 ms, with the labels going from 0.0, 0.1, ... up to 1.9, 2.0. I don't want to show the power at each tick, because I label the axis in ms, not in seconds. My data is given in seconds.

I can make this work using ($1*1000) to manually multiply the value by 1000

plot 'data.txt' using ($1*1000.0):3 w l lw 2

This does work. However, that method means I have to edit all my plots, which there are quite a few of. Also if I decide to change it later, I have to change all of them again. I would much rather make these settings in one config file.

I tried using the format specifier, e.g.

set format x "%1.1s"

But unfortunately I can't figure out how to specify a fixed power of 10 for it to use. The labels I get now are 0.0, 1.0, 2.0, ..., 9.0, 1.0, 1.1, ..., etc., instead of 0.0, 0.1, 0.2, etc.

What is the best way to do this?

  • I have a few questions: 1. Did you use the command gnuplot instead of plot ? When I install gnuplot it uses that as the command. 2. I get a syntax error with the parenthesis. Are you using bash ? 3. What should I put in a data.txt file to test my command? 4. Have you already referenced this for capital S? gnuplot.sourceforge.net/docs_4.2/node184.html – Timothy Swan Apr 24 '18 at 0:25
  • I think I solved it some other way, its over a year ago so I don't know exactly. To answer your questions: 1,2. this was part of a script that I executed by running gnuplot filename from a bash terminal. 3. I'm not sure what the data looked like; as I said, it's been over a year. 4. I don't think that solves the problem, although I haven't tested it. I have since stopped using gnuplot, I now prefer using matplotlib in python. – MTV DNA May 17 '18 at 15:38

Your Answer

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

Browse other questions tagged or ask your own question.