3

How do I plot multiple series with different x-values in Pandas? I expect the following to work but it seems to produce multiple figures.

rawdat.plot(x='ts', y=['bid','ask'], marker='.', lw=0)
plot.hold()
rawdat.plot(x='lastTrade', y='last', marker='x', lw=0)
plt.show()

1 Answer 1

3

You would need to tell matplotlib through the pandas.plot interface that you want the plots on the same axis (see docs):

ax = rawdat.plot(x='ts', y=['bid','ask'], marker='.', lw=0)
plot.hold()
rawdat.plot(x='lastTrade', y='last', marker='x', lw=0, ax=ax)
plt.show()
Sign up to request clarification or add additional context in comments.

Comments

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.