Richard
Richard

Reputation: 15592

how to explicitly plot y axis with python

I used pp.yscale('log') in my python script to plot a figure with y ticks shown in log scale. However, in the figure, the y axis does not appear. Is there any way to explicitly show y axis in python?

enter image description here

...
leg = pp.legend( series_labels, loc='upper right' )
pp.axis([-0.5, x_len-0.5, 0, max_y*1.1])   
configurable_xlabel = x_label + '(unit)'
pp.xlabel(configurable_xlabel)
configurable_ylabel = metrics[metric_idx] + '(unit)'
pp.ylabel(configurable_ylabel)
configurable_scaling = 2
xticklabels = []
for idx in xrange(0,x_len):
    if idx % configurable_scaling == 0:
        xticklabels.append(x_data[idx])
    else:
        xticklabels.append('');
pp.axes().set_xticks(xrange(0,x_len));
pp.axes().set_xticklabels(xticklabels[0:len(xticklabels)])
pp.yscale('log')
...

Upvotes: 0

Views: 446

Answers (1)

Alfe
Alfe

Reputation: 59586

This might be due to logarithmic scales having no 0, and one might be able to move the axis to another number.

Upvotes: 1

Related Questions