1

I am trying to change the values of axis...but just the axis text and not the graph.

For example, I have data as

x = [10,20,30,40]
y = [100,200,3000,400000]

Now,the graph is between x and y

so

plt.plot(x,y)

but in the axis I want

ax_x = [ex/10 for ex in x]
ax_y = [math.log(y) for ey in y]

And the axis of this graph has ax_x and ax_y as values instead of x and y?

How do i do this?

1
  • 1
    Why don't you just use plot(x/10, np.log(y))? Commented Oct 8, 2013 at 0:29

1 Answer 1

3
plt.gca().set_xticks(x, minor=False)
plt.gca().set_yticklabels(ax_x)
plt.draw()

Similar for y axis

Sign up to request clarification or add additional context in comments.

1 Comment

While this solves the problem it is really bad practice. Your data and your labels are now completely de-coupled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.