# Semilogy Plot not showing minor tick marks

15 visualizzazioni (ultimi 30 giorni)
Daniel il 14 Nov 2011
Commentato: Bruce Rodenborn il 16 Lug 2023
Hi,
I am having a problem with my semilog plot showing minor tick marks. It seems that there should be an obvious mistake that I've made but I can't seem to find one. Here is a simple example using a well known plot to illustrate my problem.
T = 200:10:1000;
h = 6.626 * 10^-34;
k = 1.38 * 10^-23;
Si_mn = 1.08 * (9.109 * 10^-31);
Si_mp = 0.81 * (9.109 * 10^-31);
Si_Eg = 1.12 * 1.602 * 10^-19;
Ge_mn = 0.56 * (9.109 * 10^-31);
Ge_mp = 0.29 * (9.109 * 10^-31);
Ge_Eg = 0.66 * (1.602 * 10^-19);
Si_NC = 2 * ((2 * pi * Si_mn * k .* T) / h^2 ).^(3/2) / 100^3;
Si_NV = 2 * ((2 * pi * Si_mp * k .* T) / h^2 ).^(3/2) / 100^3;
Ge_NC = 2 * ((2 * pi * Ge_mn * k .* T) / h^2 ).^(3/2) / 100^3;
Ge_NV = 2 * ((2 * pi * Ge_mp * k .* T) / h^2 ).^(3/2) / 100^3;
ni = sqrt(Si_NC .* Si_NV) .* exp(- Si_Eg ./ (T .* k .* 2));
ni(2,:) = sqrt(Ge_NC .* Ge_NV) .* exp(- Ge_Eg ./ (T .* k .* 2));
semilogy(1000./T,ni)
Also, I am fairly new to MATLAB so if there is a way to optimize this code, any and all input would be appreciated.
Thanks,
Daniel
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (2)

Sarah Wait Zaranek il 14 Nov 2011
The X Minor ticks are off by default. This should turn them back on.
ax = gca; % grabs current axis
set(ax,'XMinorTick','on') % sets Minor X Ticks to display
I am not sure why the Y Minor Ticks aren't showing up, but this techincal solution would work where you hardwire the ticks in that you want.
##### 2 CommentiMostra NessunoNascondi Nessuno
Jose M. Mier il 30 Ago 2012
I'm using MatLab 2010a (v. 7.10.0) and I'm having a similar issue. I have a contourf plot with a log scale on the y axis. I get the minor tick marks on the plot normally. The problem comes when saving the figure (saveas), the minor tick marks don't show up in the jpg figure, while the major tick marks are still there. I tried back and forth top and bottom 'Layer' and on and off 'YMinorTick', but still the same. The matlab figure shows them correctly but the problem is the saved jpg figure. However, when I move the tick marks to the outside, they show up in the saved jpg figure. Something tells me that for some reason the contourf is getting on top of the minor ticks when the saveas command is called. Any ideas on how to solve it? Thanks.
K E il 10 Set 2012
Start a new question and you are more likely to get an answer.

Accedi per commentare.

Bruce Rodenborn il 16 Lug 2023
Modificato: Bruce Rodenborn il 16 Lug 2023
This does not work. I if I set the ylimits in the plot, set minor ticks on, it changes its behavior in an uncontrolled way. The minor ticks disappear based on setting the font size of the axis. The plot also ignores the assighment of ytick locations. It's a bug.
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Bruce Rodenborn il 16 Lug 2023
I remedied the problem by plotting data in the positive y direction. Apparently the bug occurs when you plot negative values using semilogy.

Accedi per commentare.

### Categorie

Scopri di più su Annotations in Help Center e File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by