0
votes

I am creating a plot in Matlab with a logarithmic x-scale. When I turn the grid lines on, it creates verticle lines with steps of 10^0.1 (figure 1). I only want ticks every 10^1.

I've tried using set(gca,'xtick',10.^[-3:2]), which does not change anything. I can set most of the ticks I want (Figure 2), but as soon as I add a tick at 10^-2, all of the smaller grid lines appear as well.

Is there a way to get the gridlines I want without plotting them manually?

Figure 1

Figure 1

Figure 2

Figure 2

2

2 Answers

1
votes

Try:

grid minor;

It should get rid of the minor grid lines that you don't want.

0
votes

It works with the next commands:

set(gca,'ygrid','on')

set(gca,'xgrid','on')

set(gca,'yminorgrid','off')

set(gca,'xminorgrid','off')