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!
 

1. 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.

2. 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.

3. 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.

4. 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.

5. 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

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
4K
  • Computing and Technology
Replies
10
Views
41K
  • Programming and Computer Science
Replies
6
Views
1K
  • Computing and Technology
Replies
0
Views
190
  • Programming and Computer Science
Replies
2
Views
4K
  • Special and General Relativity
Replies
13
Views
1K
  • Nuclear Engineering
Replies
1
Views
1K
Replies
6
Views
1K
  • Special and General Relativity
Replies
15
Views
479
Back
Top