[Python] Scatter plot on log-log scale

Discussão em 'Python' iniciado por Stack, Março 23, 2025.

  1. Stack

    Stack Membro Participativo

    I want to plot a scatter plot on log-log scale like the image mentioned using python. I have mentioned the python script but I am not sure how to plot on log-log scale without changing the values of x-axis and y-axis.

    import pandas as pd
    import matplotlib.pyplot as plt
    import numpy as np
    import seaborn as sns

    f1 = pd.read_excel('/mnt/c/Users/HP/OneDrive/Objective_2/Data_analysis/aod_cloud_premonsoon.xlsx', sheet_name='Reg_plot')

    f2 = pd.read_excel('/mnt/c/Users/HP/OneDrive/Objective_2/Data_analysis/aod_cloud_monsoon.xlsx', sheet_name='raw2')

    sns.regplot(data=f1, x='AOD', y='CF', x_bins=np.arange(0.1,1.2,0.05), scatter=True, label='Premonsoon', scatter_kws={'color':'blue', 'alpha':0.5, 's':25},
    line_kws={'lw':1, 'ls':'dashed'}, ci=95) ## for premonsoon

    sns.regplot(data=f2, x='AOD', y='CF', x_bins=np.arange(0.1,1.5,0.05), scatter=True, label='Monsoon', scatter_kws={'color':'green', 'alpha':0.7, 's':25},
    line_kws={'lw':1, 'ls':'dashed', 'color':'green'}, ci=95) ## for monsoon

    plt.legend()

    plt.text(1.1,0.3, 'y=0.13x + 0.7', color='green', fontsize=12)
    plt.text(1.1,0.2,'y=0.57x + 0.02', color='blue', fontsize=12)

    Continue reading...

Compartilhe esta Página