Matplotlib Secondary y-Axis || Add another y-axis with Matplotlib twinx || Matplotlib Tips

Matplotlib Secondary y-Axis || Add another y-axis with Matplotlib twinx || Matplotlib Tips

Kimberly Fessel

3 года назад

15,269 Просмотров

Learn how to make a Matplotlib secondary y axis in this Matplotlib Tips tutorial video. I start from the basics and show you how to add another y axis with the matplotlib twinx axes method. I explain that you should consider matplotlib two y axes if your data are on two different scales. Then we learn how to use ax twinx, which creates a new set of subplot axes with an invisible x-axis but an independent y axis on the opposite side. I them demonstrate how you can color code your matplotlib secondary y axis ticks and label to make your visual more clear. I also show you code for creating a matplotlib secondary y axis legend, both as separate legends for each axis and as one ax twinx legend. I then walk you through an example of creating a seaborn secondary y axis, which means you can have seaborn two y axes as well also using plt twinx. Finally, I conclude by showing visuals of a matplotlib figure with three y axes and a matplotlib secondary x-axis using matplotlib twiny.

0:00 Introduction
0:18 BASICS: matplotlib twinx
4:53 COLOR CODE: labels, ticks, spines
8:10 LEGEND: ax twinx legend
10:52 SEABORN twinx
12:28 Other Options: 3 y-Axes and twiny
13:12 BLOOPERS

GitHub Code:
https://github.com/kimfetti/Videos/blob/master/Matplotlib_Tips/13_twinx.ipynb

Related Videos:
* Introduction to SEABORN: https://youtu.be/vaf4ir8eT38
* Matplotlib Tips PLAYLIST: https://www.youtube.com/playlist?list=PLtPIclEQf-3dJmAj3IsSRwRoLbX-n3J81

#matplotlib #dataviz

Тэги:

#matplotlib_secondary_y_axis #matplotlib_secondary_y_axis_legend #matplotlib_secondary_y_axis_ticks #matplotlib_second_y_axis #matplotlib_twinx #matplotlib_twinx_legend #matplotlib_twinx_and_twiny #matplotlib_tips #matplotlib_tips_and_tricks #seaborn_secondary_y_axis #plt_twinx #plt_twinx_legend #ax_twinx #ax_twinx_legend #seaborn_twinx #matplotlib_two_y_axes #matplotlib_two_y_axes_legend #seaborn_two_y_axes #python_matplotlib_secondary_y_axis #matplotlib_second_y_axis_color
Ссылки и html тэги не поддерживаются


Комментарии: