I am trying to use gnuplot to plot results from my experiments.
I wrote a C++ program that generates a datafile that looks like this:
10 3.5
11 3.5
12 3.5
13 3.6
What I am trying to do is to display the values of the first column of this datafile on the x-axis as powers of 2. It would look something like that (It doesn't have to look exactly the same):
http://i.stack.imgur.com/8BSLr.png
So with the datafile I posted, I want to have 2^10, 2^11, etc on the x axis. Any idea how to do that?
I can change the format of the datafile if needed.
Thanks!
this is done relatively easy by manipulating the using
specification:
plot datafile using (2**$1):2
If you do this, you'll probably also want a
set logscale x 2
set format x '2^{%L}' #<- enhanced text.
to make the plot look nicer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With