File:Distribution of Number of Species per Genus in all plant genera.png

From testwiki
Jump to navigation Jump to search
    Original file (570 × 457 pixels, file size: 22 KB, MIME type: image/png)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: Distribution of species across various genera. Each point represents a bin of a certain range of species count.

    Data from World Flora Online Plant List June 2023. https://zenodo.org/record/8079052 To reproduce, download the `classification.csv` file, then run ```python import pandas as pd import matplotlib.pyplot as plt import numpy as np

    1. Open the file with 'utf-8' encoding and 'replace' error handling

    with open('classification.csv', 'r', encoding='latin1') as file:

       df = pd.read_csv(file, delimiter='\t')
    
    1. Group by 'genus' and count the number of species in each genus

    genus_counts = df['genus'].value_counts()

    1. Get histogram data

    counts, bin_edges = np.histogram(np.log10(genus_counts), bins=100)

    1. Get bin centers

    bin_centers = (bin_edges[:-1] + bin_edges[1:]) / 2.

    1. Create scatter plot

    fig, ax = plt.subplots() ax.scatter(10**bin_centers, counts, s=5)

    1. Set log scale for y-axis

    ax.set_yscale('log') ax.set_xscale('log')

    1. Set labels

    ax.set_xlabel('Number of Species in Genus') ax.set_ylabel('Number of Genera') ax.set_title('Distribution of Number of Species per Genus')

    plt.grid() plt.show()

    ```
    Date
    Source Own work
    Author Cosmia Nebula

    Licensing

    I, the copyright holder of this work, hereby publish it under the following license:
    w:en:Creative Commons
    attribution share alike
    This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
    You are free:
    • to share – to copy, distribute and transmit the work
    • to remix – to adapt the work
    Under the following conditions:
    • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
    • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

    Captions

    Add a one-line explanation of what this file represents

    Items portrayed in this file

    depicts

    13 July 2023

    image/png

    22,778 byte

    457 pixel

    570 pixel

    c4bfc39d34ce58876c6b7c9812853199297f290a

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current08:03, 14 July 2023Thumbnail for version as of 08:03, 14 July 2023570 × 457 (22 KB)wikimediacommons>Cosmia NebulaUploaded while editing "Udny Yule" on en.wikipedia.org

    There are no pages that use this file.