Python (Matplotlib):- To plot subplots which share same Y-axis

Поделиться
HTML-код
  • Опубликовано: 15 сен 2024
  • This video explains about plotting two subplots which share same Y-axis in python.
    #python-programming

Комментарии • 1

  • @bennguyen1313
    @bennguyen1313 9 месяцев назад

    I have a csv file containing a date, followed by several data values (temperature, pressure, uv-index, etc). I'd like to :
    1) use the same x-axis (date) for all the different y-data (preferably superimposed on top of each other instead of each in its own area). The y-axis would need to show the different scales for the different y-values (0F-100F, 25hg-35hg, 1uvi-10uvi, etc).
    2) On the legend, I'd like to click on the different lines to either show or hide that data (and scale).
    I wouldn't think this is too unusual, but I haven't found any examples of this.. I'm also not sure if what methods are outdated:
    ax2 = ax1.twinx() , ax1.sharex(ax2), get_shared_y_axes, ax2.autoscale . ax2 = plt.subplot(212, sharex = ax1)