Python Tutorial: Customizing axes смотреть онлайн
Want to learn more? Take the full course at https://learn.datacamp.com/courses/introduction-to-data-visualization-in-python at your own pace. More than a video, you'll learn hands-on coding & quickly apply skills to your daily work.
---
We've seen how to create axes & subplots, but the plots were a bit messy.
Let's see how to adjust the x and y axis limits of our plots.
Sometimes, we want to create a graph and zoom in to a specific region.
To do this, the axis(), xlim(), and ylim() commands all control the left, right, upper, and lower limits of the viewable portion of the axes.
They can be set all at once using the axis() command or they can be set individually using xlim() & ylim().
We can use tuples or lists to speciy the upper and lower limits of the axes.
Let's consider an example using the US Gross Domestic Product from 1947 to 2016.
The basic plot is simple to generate and label in four lines of code.
When we issue the show() command, this is the figure generated.
Notice the vertical scale is chosen for us to fit all the data.
Suppose we want to zoom in on a portion of the graph, say the years from 1947 to 1957.
We can do this by explicitly setting the horizontal axis limits using the command xlim().
The resulting figure is not all that great; we can see that the vertical scale is too tall to see what is going on.
It's the same default vertical scale that fits all the data.
There is a similar command ylim() that we can use to specify the upper and lower limits of the y-axis.
We'll use xlim() to zoom in on the years 1947 to 1957 again and this time follow it with the ylim() command clip the vertical axis from 0 to 1000.
We can see the growth more clearly, but it's still a little flat.
We could zoom in vertically even more in principle.
Now, we'll set the horizontal limits and the vertical limits all at once, replacing the calls to xlim() and ylim() by a single call to axis().
This gives the same plot as before.
The axis() command accepts other strings as parameters as well.
These in include 'off' to stop the axes from being drawn, 'equal' to force identical scaling of x- and y-directions, and more.
For example, here is a view of a circle in two subplots. The top plot uses the default axis scaling. The bottom plot uses axis('equal') to ensure that the circle is actually a circle.
This is the code that produced the preceding figure.
Again, it's the use of axis('equal') that sets the scaling.
Take a few minutes now to practice working with these commands on your own.
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Python Tutorial: Customizing axes» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.