How to format x axis to a smaller scale in Gnuplot?

In summary, the person is trying to scale the x-axis values in a Gnuplot graph. They mention trying to divide everything by 1000, but want to know if there is a way to do it using a Gnuplot command. They found an example on Stack Overflow but had trouble with the fit function disappearing, until they multiplied it by a factor of 1000.
  • #1
bolzano95
89
7
TL;DR Summary
Scaling x-axis
So here is what I'm trying to do. The values on x-axis are from 10000, 20000, 30000, ... 100000. I'm trying to write it like this: 10, 20, 30, 40, ... 100 (only x axis)

screenshot.png


But how do I do this? I've tried those two examples How to scale the axis in Gnuplot, How to scale the axes in Gnuplot but it doesn't work. I could simply divide everything by 1000, but I'm trying to do this with gnuplot command.

Is there some way to do this in Gnuplot?
 
Computer science news on Phys.org
  • #3
I checked the link you suggested, but unfortunately the fit function dissapears. So I checked and checked what's wrong and someone suggested I should multiply the fit function by factor 1000. And it worked!
 

FAQ: How to format x axis to a smaller scale in Gnuplot?

How do I change the scale of the x axis in Gnuplot?

To change the scale of the x axis in Gnuplot, you can use the set xrange command followed by the desired minimum and maximum values. For example, set xrange [0:10] will set the x axis scale from 0 to 10.

Can I change the scale of the x axis to a logarithmic scale?

Yes, you can change the scale of the x axis to a logarithmic scale by using the set logscale x command. This will plot the values on a logarithmic scale instead of a linear scale.

How do I adjust the intervals on the x axis scale?

To adjust the intervals on the x axis scale, you can use the set xtics command followed by the desired interval value. For example, set xtics 2 will set the intervals on the x axis to be 2 units apart.

Can I change the format of the numbers on the x axis?

Yes, you can change the format of the numbers on the x axis by using the set format x command. You can specify the format using a C-style format string, such as set format x "%.2f" to display numbers with 2 decimal places.

How do I add labels to the x axis scale?

To add labels to the x axis scale, you can use the set xlabel command followed by the desired label. For example, set xlabel "Time (seconds)" will add the label "Time (seconds)" to the x axis.

Similar threads

Replies
1
Views
4K
Replies
5
Views
6K
Replies
5
Views
1K
Replies
1
Views
3K
Replies
3
Views
4K
Back
Top