Example #1
0
 def testhist(self):
     pic = r'c:\temp\plot.png'
     x = xrange(20)
     h = ap.hist(x, out_file=pic, openit=False)
     h = ap.hist(x, pic, main='Main', xlab='Xlbl', log=True, openit=False)
     os.remove(pic)
     self.assertFalse(os.path.exists(pic))
Example #2
0
 def testhist(self):
     pic = r'c:\temp\plot.png'
     x = xrange(20)
     h = ap.hist(x, out_file=pic, openit=False)
     h = ap.hist(x, pic, main='Main', xlab='Xlbl', log=True, openit=False)
     os.remove(pic)
     self.assertFalse(os.path.exists(pic))
Example #3
0
# If you are not in ArcMap, you can still plot the feature class:
ap.chart(fc)


# You can plot values in a column once you read its values into Python.
# Let's first find out what unique landuse categories there are in fc:
ap.distinct(fc, 'landuse')
# How many records of each species are there?
x = ap.values(fc, 'landuse')
ap.frequency(x)

# Now plot zinc concentration for landuse 'W'
z = ap.values(fc, 'zinc', '"landuse" = \'W\'', '"OBJECTID" ASC')
ap.plot(z)
# Arcapi now plots histograms too!
ap.hist(z)
# Show scatter plot of zinc against distance from the river
# The 'order by' clause ensures values come in the same order
d = ap.values(fc, 'dist_m', '"landuse" = \'W\'', '"OBJECTID" ASC')
ap.plot(d, z, main='Zinc', xlab='Ditance', ylab='Zn', pch='o', color='k')


# Suppose we want to add full labels indicating landuse at points.
# This can come as a table, json, or other forms. Anyhow, we would
# convert it to a Python dictionary. I simply re-typed help of 'sp':
# http://cran.r-project.org/web/packages/sp/sp.pdf
landuse2luse = {
    'Aa': 'Agriculture/unspecified', 'Ab': 'Agr/sugar beetsm',
    'Ag': 'Agr/small grains', 'Ah': 'Agr/??', 'Am': 'Agr/maize', 'B': 'woods',
    'Bw': 'trees in pasture', 'DEN': '??', 'Fh': 'tall fruit trees',
    'Fl': 'low fruit trees', 'Fw': 'fruit trees in pasture',
Example #4
0
ap.flyr(fc)
# If you are not in ArcMap, you can still plot the feature class:
ap.chart(fc)

# You can plot values in a column once you read its values into Python.
# Let's first find out what unique landuse categories there are in fc:
ap.distinct(fc, 'landuse')
# How many records of each species are there?
x = ap.values(fc, 'landuse')
ap.frequency(x)

# Now plot zinc concentration for landuse 'W'
z = ap.values(fc, 'zinc', '"landuse" = \'W\'', '"OBJECTID" ASC')
ap.plot(z)
# Arcapi now plots histograms too!
ap.hist(z)
# Show scatter plot of zinc against distance from the river
# The 'order by' clause ensures values come in the same order
d = ap.values(fc, 'dist_m', '"landuse" = \'W\'', '"OBJECTID" ASC')
ap.plot(d, z, main='Zinc', xlab='Ditance', ylab='Zn', pch='o', color='k')

# Suppose we want to add full labels indicating landuse at points.
# This can come as a table, json, or other forms. Anyhow, we would
# convert it to a Python dictionary. I simply re-typed help of 'sp':
# http://cran.r-project.org/web/packages/sp/sp.pdf
landuse2luse = {
    'Aa': 'Agriculture/unspecified',
    'Ab': 'Agr/sugar beetsm',
    'Ag': 'Agr/small grains',
    'Ah': 'Agr/??',
    'Am': 'Agr/maize',