Hi, I haven’t been able to find out how to hide the x axis in a figure in octave. I only want to show the y-axis with its scale, but the x-axis line is still present, although I can hide the tick marks.
This is the example code:
clear, close all
x = linspace(0,1,1000)’;
y = 20-x.^2
set(gca, “fontsize”, 20);
And this is the image:
axis(“off”) removes all axes, including y. And I cannot find a more specific option.
I cannot find how to do this. Eventually, if this can be solved, I would also be interested in knowing how to show/hide any axis, not just left and bottom.
something like tic[y-right] for example.
Thank you very much!
It doesn’t remove the x-axis. But you can make it merge with the background with
set(gca, 'XColor', [1 1 1]).
Hi, that is a good option. I still would like to be able to remove certain axes. Also which other properties besides XColor are available? The linewidth would be XLineWidth ?
doc "axes properties" in Octave or online.
Ok I was able to pull it off! Thank you very much!
This below is the result:
If anyone is interested in plotting orbital energy levels and occupations let me know. I can paste the whole code here, or upload it to Github
Glad it worked out! By all means, please post on Github and link from here. If anyone else needs to plot orbital energies they can find and use your code.
A slightly better way to do this is
set (gca, 'xcolor', 'none'). This will actually prevent the object (x-axis) from being drawn by the OpenGL renderer. The other way works, but will leave artifacts that can be selected if you export the figure (for example,
print output.svg). It has the additional benefit of being immune to changes in the background color (which, I know, only very infrequently deviates from white).
plot (1:10, 'o-');
set (gca, 'xcolor', 'w')
set (gcf, 'color', 'm')
set (gcf, 'inverthardcopy', 'off')
set (gca, 'xcolor', 'none')
tst1.png with “XColor” = “white”
tst2.png with “XColor” = “none”