コード例 #1
0
ファイル: generate_plot.py プロジェクト: wangg12/libskylark
def generate_plot_from_file(fname, web_dir):
    print("generating plot for %s" % (fname))
    name = fname[:fname.rfind('_')]

    procs = []
    with open(fname, 'r') as f:
        reader = csv.reader(f, delimiter=' ')
        for row in reader:
            procs.append(int(row[0]))

    procs = list(set(procs))

    pylab.plotfile(fname,
                   cols=(0, 1, 2, 3),
                   delimiter=' ',
                   names=['$n_p$', 'min', 'avg', 'max'],
                   subplots=False,
                   plotfuncs={
                       1: 'semilogy',
                       2: 'semilogy',
                       3: 'semilogy'
                   },
                   marker='s',
                   linewidth=3)
    pylab.title("%s Performance" % (name))
    pylab.ylabel("time [s]")
    pylab.xticks(procs)
    pylab.savefig("%s/plots/%s.png" % (web_dir, fname))
    return "%s.png" % (fname)
コード例 #2
0
def methodFirst():

    fname = cbook.get_sample_data(
        r'D:\Python\数据可视化\yahoo stoke API\amzn_2014-1-1_today.csv',
        asfileobj=False)
    plotfile(fname, ('date', 'high', 'low', 'close'), subplots=False)
    show()
    plotfile(fname, (0, 1, 5), plotfuncs={5: 'bar'})
    show()
コード例 #3
0
def generate_plot_from_file(fname, web_dir):
    print("generating plot for %s" % (fname))
    name = fname[:fname.rfind('_')]

    procs = []
    with open(fname, 'r') as f:
        reader = csv.reader(f, delimiter=' ')
        for row in reader:
            procs.append(int(row[0]))

    procs = list(set(procs))

    pylab.plotfile(fname, cols=(0,1,2,3), delimiter=' ',
            names=['$n_p$', 'min', 'avg', 'max'], subplots=False,
            plotfuncs={1:'semilogy', 2:'semilogy', 3:'semilogy'},
            marker='s', linewidth=3)
    pylab.title("%s Performance" % (name))
    pylab.ylabel("time [s]")
    pylab.xticks(procs)
    pylab.savefig("%s/plots/%s.png" % (web_dir, fname))
    return "%s.png" % (fname)
コード例 #4
0
def plotmythings_lines():
    if len(sys.argv) == 1:
        print 'Too few arguments'
        sys.exit()

        if len(sys.argv) > 2 and sys.argv[2] == 'using':
            j = int(sys.argv[3])
            k = int(sys.argv[4])
            i = sys.argv[1]
            plt.plotfile(i, delimiter=' ', cols=(j - 1, k - 1))

        else:
            for i in sys.argv:
                if i == sys.argv[1]:
                    plt.plotfile(i, delimiter=' ', cols=(0, 1))
                if (i != sys.argv[1] and i != sys.argv[0]):
                    plt.plotfile(i, delimiter=' ', newfig=False, cols=(0, 1))
コード例 #5
0
def plotmythings_lines( ):
    if len(sys.argv)==1:
        print 'Too few arguments'
        sys.exit()


        if len(sys.argv)>2 and sys.argv[2]=='using':
            j=int(sys.argv[3])
            k=int(sys.argv[4])
            i=sys.argv[1]
            plt.plotfile(i, delimiter=' ', cols=(j-1,k-1))

        else:
            for i in sys.argv:
                if i==sys.argv[1]:
                    plt.plotfile(i, delimiter=' ', cols=(0,1))
                if (i!=sys.argv[1] and i!=sys.argv[0]):
                    plt.plotfile(i, delimiter=' ',newfig=False,cols=(0,1))
コード例 #6
0
#!/usr/bin/env python

# Documentation of 'plotfile' see -
# http://matplotlib.org/api/pyplot_api.html#module-matplotlib.pyplot

# This script is used to plot the data generated by - 'test_airsea'

from pylab import plotfile, show, gca, savefig

fname = "fort.200"
plotfile(fname, (
    0,
    1,
    2,
), delimiter=' ', subplots=False)
gca().set_xlabel(r'Wind speed')
gca().set_title(r'Momentum bulk transfer coefficient')
savefig('cdd.png')
show()

plotfile(fname, (
    0,
    3,
    4,
), delimiter=' ', subplots=False)
gca().set_xlabel(r'Wind speed')
gca().set_title(r'Latent heat bulk transfer coefficient')
savefig('ced.png')
show()

plotfile(fname, (
コード例 #7
0
ファイル: plot_airsea.py プロジェクト: BoldingBruggeman/gotm
#!/usr/bin/env python

# Documentation of 'plotfile' see -
# http://matplotlib.org/api/pyplot_api.html#module-matplotlib.pyplot

# This script is used to plot the data generated by - 'test_airsea'

from pylab import plotfile, show, gca, savefig

fname="fort.100"
plotfile(fname, (0, 1, 2, 3, 4), delimiter=' ',subplots=False)
gca().set_xlabel(r'hour')
gca().set_title(r'Solar zenith angle (1 day)')
savefig('solar_zenith_angle_day.png')
show()

fname="fort.101"
plotfile(fname, (0, 1, 2, 3, 4), delimiter=' ',subplots=False)
gca().set_xlabel(r'hour')
gca().set_title(r'Short wave radiation (1 day)')
savefig('short_wave_radiation_day.png')
show()

fname="fort.200"
plotfile(fname, (0, 1, 2, 3, 4), delimiter=' ',subplots=False)
gca().set_xlabel(r'day')
gca().set_title(r'Solar zenith angle (1 year)')
savefig('solar_zenith_angle_year.png')
show()

fname="fort.201"
コード例 #8
0
ファイル: dibujador.py プロジェクト: bt0DotNinja/moead
#!/usr/bin/env python
# Alberto Rodriguez Sanchez
import pylab
import numpy as np
import sys

if __name__ == '__main__':
    assert len(sys.argv) > 1, "Argumentos insuficientes"
    try:
        pylab.plotfile(sys.argv[1],
                       delimiter=' ',
                       cols=(0, 1),
                       names=('f1', 'f2'))
        pylab.show()
    except IOError as e:
        print "I/O error({0}):{1}".format(e.errno, e.strerror)
コード例 #9
0
ファイル: Demo7.py プロジェクト: RogerGan/MyPythonStudyLoad
__data__ = '2015-09-23 16:28'

__mail__ = '[email protected]/[email protected]'

__weibo__ = 'http://weibo.com/ganchaojiang'


from pylab import plotfile, show, gca
import matplotlib.cbook as cbook

fname = cbook.get_sample_data('msft.csv', asfileobj=False)
fname2 = cbook.get_sample_data('data_x_x2_x3.csv', asfileobj=False)

# test 1; use ints
plotfile(fname, (0,5,6))

# test 2; use names
plotfile(fname, ('date', 'volume', 'adj_close'))

# test 3; use semilogy for volume
plotfile(fname, ('date', 'volume', 'adj_close'), plotfuncs={'volume': 'semilogy'})

# test 4; use semilogy for volume
plotfile(fname, (0,5,6), plotfuncs={5:'semilogy'})

#test 5; single subplot
plotfile(fname, ('date', 'open', 'high', 'low', 'close'), subplots=False)

# test 6; labeling, if no names in csv-file
plotfile(fname2, cols=(0,1,2), delimiter=' ',
コード例 #10
0
"""
  Name     : 4375OS_07_27_volume_and_price_2_plots.py
  Book     : Python for Finance
  Publisher: Packt Publishing Ltd. 
  Author   : Yuxing Yan
  Date     : 12/26/2013
  email    : [email protected]
             [email protected]
"""

from pylab import plotfile, show
import matplotlib.finance as finance
ticker = 'IBM'
begdate = datetime.date(2013,1,1)
enddate = datetime.date.today()
x= finance.fetch_historical_yahoo(ticker, begdate, enddate)
plotfile(x, (0,5,6))
show()


コード例 #11
0
ファイル: stockchart2.py プロジェクト: anirudhmuhnot/Books
from pylab import plotfile, show
import matplotlib.cbook as cbook  
fname = cbook.get_sample_data('/Users/MacBook/Downloads/Book_code/Chapter4/amzn.csv', asfileobj=False) 
plotfile(fname, (0,1,5), plotfuncs={5:'bar'}) 
show()

コード例 #12
0
ファイル: fplot.py プロジェクト: sanjayankur31/genesis-2.4
def plot(filename):
    print('Plotting %s' % filename)
    pylab.plotfile(filename, cols=(0, 1), delimiter=' ', subplots=False)
    pylab.show()
コード例 #13
0
ファイル: plotfile_demo.py プロジェクト: jtomase/matplotlib
from pylab import plotfile, show

fname = 'data/msft.csv'

# test 1; use ints
plotfile(fname, (0, 5, 6))

# test 2; use names
plotfile(fname, ('date', 'volume', 'adj_close'))

# test 3; use semilogy for volume
plotfile(fname, ('date', 'volume', 'adj_close'),
         plotfuncs={'volume': 'semilogy'})

# test 4; use semilogy for volume
plotfile(fname, (0, 5, 6), plotfuncs={5: 'semilogy'})

# test 5; use bar for volume
plotfile(fname, (0, 5, 6), plotfuncs={5: 'bar'})

show()
コード例 #14
0
from pylab import plotfile, show, gca
import matplotlib.cbook as cbook

fname = cbook.get_sample_data('/home/wuqili/datavis/amzn.csv', asfileobj=False)
plotfile(fname, (0,4,6 ), plotfuncs={'Volume':'bar'})
show()
コード例 #15
0
ファイル: plotfile_demo.py プロジェクト: eddienko/SamPy
from pylab import plotfile, show

fname = 'data/msft.csv'    

# test 1; use ints
plotfile(fname, (0,5,6))

# test 2; use names
plotfile(fname, ('date', 'volume', 'adj_close'))

# test 3; use semilogy for volume
plotfile(fname, ('date', 'volume', 'adj_close'), plotfuncs={'volume': 'semilogy'})

# test 4; use semilogy for volume
plotfile(fname, (0,5,6), plotfuncs={5:'semilogy'})

# test 5; use bar for volume
plotfile(fname, (0,5,6), plotfuncs={5:'bar'})

show()


コード例 #16
0
ファイル: stockchart1.py プロジェクト: anirudhmuhnot/Books
from pylab import plotfile, show, gca
import matplotlib.cbook as cbook
fname = cbook.get_sample_data(
    '/Users/MacBook/Downloads/Book_Code/Chapter4/amzn.csv', asfileobj=False)
plotfile(fname, ('date', 'high', 'low', 'close'), subplots=False)
show()
コード例 #17
0
ファイル: pylab_example.py プロジェクト: r2k0/fe4retail
from pylab import plotfile, show, gca
import matplotlib.cbook as cbook

fname = cbook.get_sample_data('msft.csv',asfileobj=False)

plotfile(fname,(0,5,6))
plotfile(fname,('date','volume','adj_close'))

show()
コード例 #18
0
ファイル: plot_a_csv.py プロジェクト: saideepbsd/TCP
from pylab import plotfile, show, gca
import matplotlib.cbook as cbook

fname = cbook.get_sample_data('/home/dual/cs5120284/Desktop/TCP_/bic.csv', asfileobj=False)
#fname2 = cbook.get_sample_data('data_x_x2_x3.csv', asfileobj=False)

# test 1; use ints
plotfile(fname, (1,2,0))
'''
# test 2; use names
plotfile(fname, ('date', 'volume', 'adj_close'))

# test 3; use semilogy for volume
plotfile(fname, ('date', 'volume', 'adj_close'), plotfuncs={'volume': 'semilogy'})

# test 4; use semilogy for volume
plotfile(fname, (0,5,6), plotfuncs={5:'semilogy'})

#test 5; single subplot
plotfile(fname, ('date', 'open', 'high', 'low', 'close'), subplots=False)

# test 6; labeling, if no names in csv-file
plotfile(fname2, cols=(0,1,2), delimiter=' ',
         names=['$x$', '$f(x)=x^2$', '$f(x)=x^3$'])

# test 7; more than one file per figure--illustrated here with a single file
plotfile(fname2, cols=(0, 1), delimiter=' ')
plotfile(fname2, cols=(0, 2), newfig=False, delimiter=' ') # use current figure
gca().set_xlabel(r'$x$')
gca().set_ylabel(r'$f(x) = x^2, x^3$')
コード例 #19
0
ファイル: plot_airsea.py プロジェクト: E3SM-Project/GOTMcode
#!/usr/bin/env python

# Documentation of 'plotfile' see -
# http://matplotlib.org/api/pyplot_api.html#module-matplotlib.pyplot

# This script is used to plot the data generated by - 'test_airsea'

from pylab import plotfile, show, gca, savefig

fname = "fort.100"
plotfile(fname, (0, 1, 2, 3, 4), delimiter=' ', subplots=False)
gca().set_xlabel(r'hour')
gca().set_title(r'Solar zenith angle (1 day)')
savefig('solar_zenith_angle_day.png')
show()

fname = "fort.101"
plotfile(fname, (0, 1, 2, 3, 4), delimiter=' ', subplots=False)
gca().set_xlabel(r'hour')
gca().set_title(r'Short wave radiation (1 day)')
savefig('short_wave_radiation_day.png')
show()

fname = "fort.200"
plotfile(fname, (0, 1, 2, 3, 4), delimiter=' ', subplots=False)
gca().set_xlabel(r'day')
gca().set_title(r'Solar zenith angle (1 year)')
savefig('solar_zenith_angle_year.png')
show()

fname = "fort.201"
コード例 #20
0
ファイル: plot.py プロジェクト: sens/test_gn_pylmm
import sys
from pylab import plotfile, show, gca
import matplotlib
import matplotlib.cbook as cbook

fn = sys.argv[1]
print "fn=",fn

matplotlib.rcParams['examples.directory'] = '.'
fname = cbook.get_sample_data(fn,asfileobj=True )

plotfile(fname, ('date', 'pylmm1', 'pylmm2'), subplots=False)

show()
"""
  Name     : 4375OS_07_27_volume_and_price_2_plots.py
  Book     : Python for Finance
  Publisher: Packt Publishing Ltd. 
  Author   : Yuxing Yan
  Date     : 12/26/2013
  email    : [email protected]
             [email protected]
"""

from pylab import plotfile, show
import matplotlib.finance as finance
ticker = 'IBM'
begdate = datetime.date(2013, 1, 1)
enddate = datetime.date.today()
x = finance.fetch_historical_yahoo(ticker, begdate, enddate)
plotfile(x, (0, 5, 6))
show()
コード例 #22
0
ファイル: plot_albedo.py プロジェクト: E3SM-Project/GOTMcode
#!/usr/bin/env python

# Documentation of 'plotfile' see -
# http://matplotlib.org/api/pyplot_api.html#module-matplotlib.pyplot

# This script is used to plot the data generated by - 'test_albedo'

from pylab import plotfile, show, gca, savefig

fname="fort.100"
plotfile(fname, (0, 1, 2, 3, 4, 5), delimiter=' ',subplots=False)
gca().set_xlabel(r'angle')
gca().set_title(r'Albedo as function of zenith angle')
savefig('albedo_zenith.png')
show()

fname="fort.101"
plotfile(fname, (0, 1, 2, 3, 4, 5, 6, 7, 8 ), delimiter=' ',subplots=False)
gca().set_xlabel(r'year day')
gca().set_title(r'Albedo as function of year day')
savefig('albedo_yearday.png')
show()
コード例 #23
0
ファイル: fplot.py プロジェクト: JustasB/ACnet2
def plot(filename):
    print 'Plotting %s' % filename
    pylab.plotfile(filename, cols=(0,1), delimiter=' ', subplots=False)
    pylab.show()
コード例 #24
0
ファイル: plots.py プロジェクト: das-g/CSP-Ex
#!/usr/bin/env python

import pylab as pl

pl.plotfile("./everything_vs_kT.dat", cols=range(5), delimiter='\t')
pl.savefig("everything_vs_kT.png")

pl.plotfile("./everything_vs_system_size.dat", cols=range(5), plotfuncs={2:'plot',3:'semilogy'}, delimiter='\t')
pl.savefig("everything_vs_system_size.png")
コード例 #25
0
ファイル: plotfile_demo.py プロジェクト: zhanfeng/matplotlib2
from pylab import plotfile, show, gca
import matplotlib.cbook as cbook

fname = cbook.get_sample_data('msft.csv', asfileobj=False)
fname2 = cbook.get_sample_data('data_x_x2_x3.csv', asfileobj=False)

# test 1; use ints
plotfile(fname, (0, 5, 6))

# test 2; use names
plotfile(fname, ('date', 'volume', 'adj_close'))

# test 3; use semilogy for volume
plotfile(fname, ('date', 'volume', 'adj_close'),
         plotfuncs={'volume': 'semilogy'})

# test 4; use semilogy for volume
plotfile(fname, (0, 5, 6), plotfuncs={5: 'semilogy'})

# test 5; single subplot
plotfile(fname, ('date', 'open', 'high', 'low', 'close'), subplots=False)

# test 6; labeling, if no names in csv-file
plotfile(fname2,
         cols=(0, 1, 2),
         delimiter=' ',
         names=['$x$', '$f(x)=x^2$', '$f(x)=x^3$'])

# test 7; more than one file per figure--illustrated here with a single file
plotfile(fname2, cols=(0, 1), delimiter=' ')
plotfile(fname2, cols=(0, 2), newfig=False,
コード例 #26
0
ファイル: plot_interval.py プロジェクト: HackLinux/scripts
from pylab import plotfile, show, gca
import matplotlib.cbook as cbook

fname = cbook.get_sample_data('/Users/joy/Dropbox/utsa/research/mascots/results/var_interval-1.csv.csv', asfileobj=False)
#fname2 = cbook.get_sample_data('data_x_x2_x3.csv', asfileobj=False)

# test 1; u

plotfile(fname, (0, 1), subplots=False)
show()