Custom axis scales - "Reverse" logarithmic?

Sorry for the bad title;)

I am trying to recreate the plot of Matlab, which I met in some other work, but I do not quite understand the scale that they use. The y-axis increments are as follows (above [+ ve y]):

0.9999, 0.999, 0.99, 0.9, 0

I can use semilogy to build a logarithmic graph, but this is kind of the wrong way; my increments go

1, 0.1, 0.01, 0.001, etc.

which is actually 1 - i, where i are the increments that i really want! I do not quite understand how to describe this type of plot; can anyone help?

+4
source share
2 answers

, , : (1) 1-y, (2) (3)

y = [0.4 0.8 0.99 0.9999];

%# plot 1-y 
plot(1-y) %# alternatively use semilog, then you won't have to adjust 'yscale' below

%# reverse y-axis
set(gca,'ydir','reverse','yscale','log')

%# if necessary, set the axis limits here

%# relabel y-axis
set(gca,'yticklabel',num2str(1-10.^str2num(get(gca,'yticklabel'))))

enter image description here

+4

@Jonas, matplotlib. ,

y = np.array([0.1, 0.5, 0.9, 0.99, 0.999])

plt.yscale('log')
plt.gca().invert_yaxis()
plt.plot(x, 1-y)
plt.gca().set_yticklabels(1-plt.gca().get_yticks())
0

All Articles