Limit the number of ytics and keep mytics when using logscale - gnuplot

This question is somewhat similar to Limit the number of ytics while using automatic ytics placement but doesn't get answered in that thread.
I used the following code to generate my graph gnuplot:
set yrange[.125:512]
set logscale y 2
set ytics 2
set mytics 16
set grid mytics ytics
set key off
plot '20131019_square.log' using 2:xticlabels(1) with linespoints linestyle 2
resulting in graph_1. (post it in comment because this is my first post <10 rep)
I find the ytics somewhat dense, so I change set ytics 2 to set ytics 8
resulting in graph_2
In this second graph the spacing is fine, but mytics behaves incorrect (I need logspacing) and the tics numbering I really want to use is (.03125,0.125,.5,2,8,32,128,512) what I can obtain using set ytics to (.03125,0.125,.5,2,8,32,128,512)
resulting in graph_3
Everything is correct in the last one, but I'll lose my minor ytics. (This is normal behavior for gnuplot, but I would like to get the tics of this graph_3.)
Any ideas on how to get graph_3 with mytics?

You can have minor tics only for automatically generated major tics like you get with:
set ytics 0.03125,4
With logscale set, the increment (here 4) is treated as a multiplier for the starting value (here 0.03125).
A full, minimal script would then be
set logscale y 2
set yrange[0.03125:512]
set ytics 0.03125,4
set mytics
set xrange[0:10]
plot x

Related

Gnuplot: removing or moving tics at the border of graph with autoscaled tics

I'm trying to add an empty boundary around the data in an autoscaled graph without having tics in the empty boundary or at the border.
$ gnuplot -p -e "set offsets 0,0,0.1,0.1; plot sin(x)"
Desired result
Tics are gone at the y-axis border/in the empty boundary
set offsets 0,0,0.25,0.25
set yrange noextend
plot sin(x)
There is also the possibility to approach this quite differently, which may or may not be appropriate for your case.
set border 2
set ytics rangelimited
set xtics axis
set tics nomirror
set xzeroaxis
set offsets 0.,0.,.25,.25
plot sin(x)
Most likely you are looking for set autoscale noextend, check help noextend. You can give the offset also in graph coordinates to be independent of the actual y-scale, check help offsets.
Script:
### autoscale noextend
reset session
set autoscale noextend
set offsets 0,0, graph 0.1, graph 0.1
plot sin(x)
### end of script
Result:

Manual scaling of axis (poltting with boxes) in gnuplot

I'm trying to plot a really long list, which represents frequency of some data. The x axis goes from 1 to 1881, and the y goes from 1 to 1978. I tried plotting with the following configurations:
set log y 5
set log x 32
set xtics 2
set ytics 5
plot "freq.dat" w boxes
But i get the following result:
Which is clearly not good because there are these intersections of the boxes. I want to have some kind of scale that have a lot more space between 10 and 150 than the outside of this area. How can i do that? I've tried every combination of logs and xtics and couldn't make it look good. The y axis seems good to me, the only problem is the spacing of x-axis.
Also, i want to know how to do this in gnuplot specifically (if possible).
Thanks.
It seems to me that your script overrides somewhere the default boxwidth. The default behavior is:
By default, adjacent boxes are extended in width until they touch
each other. A different default width may be specified using the set boxwidth command. Relative widths are interpreted as being a
fraction of this default width.
So for example this:
set terminal pngcairo enhanced
set output 'fig.png'
set log x 2
set log y 5
set yr [0.2:3125]
set xr [1:512]
set boxwidth 1 relative
set xtics 1,2,512 out nomirror
set ytics 1,5,3125 out nomirror
unset key
#set style fill pattern 6
plot 'freq.dat' w boxes lc rgb 'royalblue' lw 1.1
then yields:

Resetting xtics ytics gnuplot

Is there any way to reset or to use the default settings for xtics (or ytics) after I've already used a custom setting?
I need something like that:
set ytics 0.005 nomirror
set y2tics 5 nomirror
plot 'dummy' u 1:2 axes x1y1, dummy2 u 1:2 axes x1y2
##Another plot with "normal" axes
set ytics default (this command doesn't exist but this is what I need)
set y2tics default
plot 'dummy3' u 1:2
So if that command would actually exist, that would solve my problem because what I have now is that the second plot is using, of course, the ytics defined for the previous one. And I don't want to use the reset option because I don't want to define everything again in my script.
Thank you very much!
You could put reset before your second plot. But it will reset everything and might be an overkill for you.
You can also use set ytics auto. It might be better.
Best,
From gnuplot help:
The defaults are border mirror norotate for tics on the x and y axes, and
border nomirror norotate for tics on the x2 and y2 axes.
So, your commands should be:
set ytics border mirror norotate autofreq
set y2tics border nomirror norotate autofreq
Use:
unset ytics
from http://www.gnuplot.info/docs_4.2/node295.html
The tics may be turned off with the unset xtics command

How to label "xtics" at every second points?

Hi I am plotting a graph with Gnuplot and using below command.
set xrange [0:20]
set xtics 0,0.5
The graph and scale are correct as I wanted. But I would like to label only integer points (e.g. 0,1,2,3,4...,20) but I still want to keep tics at every 0.5 interval.
How can I command for that?
thanks
Minor tics are set with set mxtics:
set xrange [0:20]
set xtics 0,1
set mxtics 2
This plots a single minor tic between two labelled major tics.
If minor and major tics should have the same size use
set xtics scale 1,1

gnuplot: how to make x y axis without xtics and ytics

I am using gnuplot to draw something.
And by default there will be tics on the axis, but I don't need these tics. How to remove them?
I search some manual about the usage of set xtics, but did not find any clue.
Just issue the command unset xtics and unset ytics to remove tics from both x and y axis.

Resources