File:Ohio temps qq.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 360 × 315 pixels, file size: 27 KB)

    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: A quantile-quantile plot comparing the distributions of daily maximum temperature in the U.S. state of Ohio in March and in July.
    Date
    Source Own work
    Author Skbkekas
    SVG development
    InfoField
     The SVG code is valid.
     This plot was created with Matplotlib.
    Source code
    InfoField

    Python code

    ## "state33" data file obtained from: ftp://ftp.ncdc.noaa.gov/pub/data/ushcn/daily/README
    
    import gzip
    import numpy as np
    import matplotlib.pyplot as plt
    
    fid = gzip.open("state33.gz")
    
    month1 = 3
    month2 = 7
    
    M1,M2 = [],[]
    for line in fid:
    
        stid = int(line[0:7])
    
        if line[7:11]=="TMAX":
            mo = int(line[17:19])
            nday = int(line[20:22])
            if mo not in [month1,month2]: continue
            V,ii = [],26
            for k in range(nday):
                V.append(float(line[ii:ii+2]))
                ii += 8
            if mo==month1: M1.extend(V)
            if mo==month2: M2.extend(V)
    
    M1 = np.array(np.sort(M1))
    M2 = np.array(np.sort(M2))
    
    M1 = M1[M1!=99]
    M2 = M2[M2!=99]
    
    M1 = (M1-M1.mean())/M1.std()
    M2 = (M2-M2.mean())/M2.std()
    
    Q1 = [M1[int(q*len(M1))] for q in np.arange(1,1000,dtype=np.float64)/1000]
    Q2 = [M2[int(q*len(M2))] for q in np.arange(1,1000,dtype=np.float64)/1000]
    
    P1 = [M1[int(q*len(M1))] for q in np.arange(1,10,dtype=np.float64)/10]
    P2 = [M2[int(q*len(M2))] for q in np.arange(1,10,dtype=np.float64)/10]
    
    plt.clf()
    plt.figure(figsize=(4,3.5))
    plt.axes([0.15,0.15,0.8,0.8])
    plt.grid(True)
    plt.plot(Q1, Q2, '-', color="gray", lw=3)
    plt.hold(True)
    plt.plot([-3,3], [-3,3], '-', color='black')
    plt.plot(P1, P2, 'o', mec='black', mfc='red')
    plt.xlim(-2,3)
    plt.ylim(-2,3)
    plt.xlabel("March", size=14)
    plt.ylabel("July", size=14)
    plt.savefig("ohio_temps_qq.pdf")
    plt.savefig("ohio_temps_qq.svg")
    

    Licensing

    I, the copyright holder of this work, hereby publish it under the following license:
    w:en:Creative Commons
    attribution
    This file is licensed under the Creative Commons Attribution 3.0 Unported 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.

    Captions

    Add a one-line explanation of what this file represents

    Items portrayed in this file

    depicts

    13 November 2009

    27,560 byte

    image/svg+xml

    5836574988d59509abcdd3070f8e565778592864

    File history

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

    Date/TimeThumbnailDimensionsUserComment
    current15:52, 13 November 2009Thumbnail for version as of 15:52, 13 November 2009360 × 315 (27 KB)wikimediacommons>Skbkekas{{Information |Description={{en|1=A quantile-quantile plot comparing the distributions of daily maximum temperature in the U.S. state of Ohio in March and in July.}} |Source={{own}} |Author=Skbkekas |Date=2009-11-13 |Permission= |other_v

    There are no pages that use this file.