Using a log scale on gnuplot - gnuplot

I am trying to change my scale on gnuplot. I had a file from which I am plotting the fifth and sixth columns, and I am trying to change the x axis to a log scale. I am using
set logscale <2>
but it is saing that 'x' is an invalid axis. Is there a way to find out what the "name" of my 'x' axis is so that I can use this command?

From your question it's rather hard to see what you exactly want. Comment if this isn't what you're looking for. It sounds like you want to set the x axis to logscale base 2. It's done this way
set logscale x 2
In general, this is the command
set logscale <axes> <base>

Related

What the 'set logscale' does in gnuplot?

My question is more about math then the actual code.
When use the command
set logscale
on gnuplot 5.0 what is happening ?
It should represents the logarithmic values values of the x and y points.
But it doesn not seems to work properly. For example on my data I have x and y values smaller then 1 so I am expecting to see negative values for these values on the plot, but I see only postivie values.
What I am doing wrong ?
The logarithmic scale still shows the real values around the axes, just their distances are logarithmic. To really see the negative values, you need to really apply the log function:
plot "file.dat" using (log($1)):(log($2)) with lines
without setting the logscale.
A specific example might help to illustrate the effect of logarithmic scaling:
set xrange [0.1:10]
plot x**2
Let's plot this again, but this time on a logarithmic scale. Watch how the scaling of the x and y axes changes:
set logscale
replot

Editing y axis range in Gnuplot

I have a plot with exponential y axis range. I'm using multiplot command by inserting two images in one row. So due to this wide y axis range I'm loosing some space which I could use it to show my plots in a better way. I want basically something like this
How could i do this? I think for doing this I have do some math operations in the y axis range. Also what is the most convenient command to insert ( xE-10) at top left of the plot.
reset
set terminal epslatex size 16cm,18cm color colortext
set output new.tex
set key off
set format $%g$
set title "sinx"
set ylabel "[kNm]"
plot 1000000*sin(x)
This is not my exact code but it looks similar to this. The plot I have presented is a part of the multiplot code and I use 7 input files with time series data of 300 seconds at a time step of 0.02. The point I want to edit the y axis range (use some mathtematical expressions) and also include the term ( xE-10 ) on the top of the plot something like this
You can manually add the exponent with a set label .... For instance, the following function takes large values within the given interval:
plot[0:50] exp(x)
We can place the "x 10^21" manually in the desired place after dividing the plotted quantity by it:
set label 1 "{/Symbol \264} 10^{21}" at graph 0,1.025 left
plot[0:50] exp(x)/1e21
You have to be careful with the exact placement of the exponent since it might lie outside the plotting area, in which case you should lower the top margin with set tmargin .... Also, to use the "times" symbol, you need to pass the enhanced option to your terminal. With the epslatex terminal, you can use latex syntax: $\times 10^{21}$.

Gnuplot: nonlinear scaling for y axis

I have 2 datasets which I want to plot on top of each other. The first data set has a yrange of [-10:10], while the second has a range of [-2:2]. If I just plot them on top of each other in the usual linear scale, it is very difficult to see any features of the second data set:
Ideally I would like a nonlinear scale on the y axis to really emphasise what is going on between -2 and 2. I would like to design a y axis which looks like this:
So that most of the middle part of the plot is between -2 and 2. (I just manually added ytics in this figure) Does anyone know how to accomplish this via the "set link" command or something similar?

GNUPlot: Display less marks on x-axis?

I'm trying to get less marks on the x axis to display, since it's not exactly readable as to what size those values are.
Right now I'm using the
set xrange [1000:1000000]
directive.
You can use the command
`set xtics 5e5`
(or some other number) to space the tics further apart. For your data it looks like three tics are fine, you could even get away with two:
`set xtics 1e6`
Sadly gnuplot lacks an option to set the number of tics explicitly.

adding space between x axis and xtics in gnuplot histogram

Currently I created graphs with small size. The spacing really important at this case. I want to add more vertical space between my xticlabels and x axis.
I have tried to set the x bar with
set xtics offset 0,graph 0.05
my gnuplot output:
The data and gnuplot script still same with my previous question here.
You can do the following:
First add a little bit of bmargin by
set bmargin 3
Since you need to add vertical space between your xticlabels and x-axis, you need to adjust the Y-offset, which can be done by the following
set xtics offset 0,-1,0
You can play around with the values to suite your need.

Resources