#Scatterplot with continuous hues and sizes
import matplotlib.pyplot as plt
#conda install -c anaconda seaborn
import seaborn as sns
sns.set_theme(style="whitegrid")


def main():
    # Load the example planets dataset
    planets = sns.load_dataset("planets")
    cmap = sns.cubehelix_palette(rot=-.2, as_cmap=True)
    g = sns.relplot(
        data=planets,
        x="distance", y="orbital_period",
        hue="year", size="mass",
        palette=cmap, sizes=(10, 200),
    )
    g.set(xscale="log", yscale="log")
    g.ax.xaxis.grid(True, "minor", linewidth=.25)
    g.ax.yaxis.grid(True, "minor", linewidth=.25)
    g.despine(left=True, bottom=True)
    plt.savefig("ex376.png", dpi=100)
    plt.show()

if __name__ == '__main__':
    main()

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading