Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть How to plot data on primary and inverted secondary axis using python

  • My Knowlege space
  • 2024-05-05
  • 185
How to plot data on primary and inverted secondary axis using python
pythonbar plot in pythonrainfall vs slopeplot in inverse secondary axisinverse secondary axishow to reverse plot in pythonplots in poython
  • ok logo

Скачать How to plot data on primary and inverted secondary axis using python бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно How to plot data on primary and inverted secondary axis using python или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку How to plot data on primary and inverted secondary axis using python бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео How to plot data on primary and inverted secondary axis using python

In this video a detailed description of how we can plot a bar plot of data in primary and secondary axis using python.

Previous videos:
1. Clip raster in Python
   • How to Clip rasters in Python  
2. How to download DEM data | SRTM 90m data
   • How to download DEM data | SRTM 90m data  
3. How to plot Shapefile in Python | Part-03
   • How to plot Shapefile in Python | Part-03  
4. How to plot Shapefile in Python | Part-02
   • How to plot Shapefile in Python | Part-02  
5. How to plot Shapefile in Python | Part-01
   • How to plot Shapefile in Python | Part-01  


##code
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

df_rainfall = pd.read_excel('path to rainfall data')
df_slope = pd.read_excel('path to slope data')

Assuming both DataFrames have the same length
If not, you may need to interpolate or align them accordingly
df_combined = pd.concat([df_rainfall['cumulative distance'], df_rainfall['Rainfall'], df_slope['slope']], axis=1)

Get the number of data points
num_data_points = len(df_combined)


Plotting
fig, ax1 = plt.subplots(figsize=(12, 7))

# Plotting bar plot with index vs rainfall on primary y-axis
ax1.bar(np.arange(num_data_points), df_combined['Rainfall'].values, color='tab:blue', label='Rainfall')
ax1.set_xlabel('Number of points', fontsize=16) # Change x-axis label
ax1.set_ylabel('Rainfall (mm)', color='tab:blue', fontsize=16)
ax1.tick_params(axis='y', labelcolor='tab:blue', labelsize=14)
ax1.set_ylim(0, 180)
Adjust tick sizes of x-axis
ax1.tick_params(axis='x', labelsize=14)
ax1.grid(True)

Create a secondary y-axis for slope
ax2 = ax1.twinx()

# Plotting bar plot with index vs slope on secondary y-axis
ax2.bar(np.arange(num_data_points), df_combined['slope'].values, color='tab:orange', label='Slope')
ax2.set_ylabel('Slope (m/m)',color='tab:orange', fontsize=16)
ax2.tick_params(axis='y', labelcolor='tab:orange', labelsize=14)



Set the limits of the secondary y-axis
ax2.set_ylim(0, 0.2) # Adjust the limits as needed
# Reverse the secondary y-axis
ax2.set_ylim(ax2.get_ylim()[::-1])
plt.title('Rainfall vs Slope ', fontsize=20)

plt.savefig('path to save figure')

plt.show()

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]