gnuplot - Octave: Log plot with arbitrary log base automatically -
i want plot info in log scale can't find alternative automatically alter base of operations of log scale.
x = 1:100; y = 2 .^ x; semilogy(x, y);
gives me
i have been able manually alter y ticks.
x = 1:100; y = 2 .^ x; semilogy(x, y); set(gca, 'ytick', 2 .^ (0:20:100)); set(gca, 'yticklabel', {'2^{0}' '2^{20}' '2^{40}' '2^{60}' '2^{80}' '2^{100}'});
gives me
i satisfied plot get, out of curiosity, there alternative automatically alter log base of operations of log scale?
as christoph said there no alternative in octave or matlab. may automate little bit process, , ensure consistency between ticks positions , labels, explained here.
for instance
x = 1:100; y = 2 .^ x; semilogy(x, y); base of operations = 2; tick_exponents = 0:20:100; set(gca, 'ytick', base of operations .^ tick_exponents); format_string = sprintf('%d^{%%d}', base); tick_labels = num2str(tick_exponents(:), format_string) set(gca, 'yticklabel', tick_labels);
which yields
plot gnuplot octave
No comments:
Post a Comment