matplotlib using twinx and twiny together (like twinxy)

前端 未结 1 1224
予麋鹿
予麋鹿 2020-12-03 16:59

Can I have both twinx and twiny together (i.e. something like twinxy)? I want to put a CDF on a bar plot where the X axis of the bar plot is in log-scale. I cannot make the

相关标签:
1条回答
  • 2020-12-03 17:43

    If I understand your question right, you want to plot two things on the same axes with no shared axis. There is probably a better way to do this, but you can stack twinx (doc) and twiny (doc) as such

    ax # your first axes
    ax_new = ax.twinx().twiny()
    

    Which will give you tick marks on all sides of the plot. ax will plot against the bottom and left, ax_new will plot against the top and right.

    0 讨论(0)
提交回复
热议问题