I am writing a tool in python which passes parameters to a R script, which in turn creates a DBF file. I read this DBF and want to make a histogram out of the data inside ArcMap as one of the results of the tool.
The code snippet is as follows:
import arcpy simloglkhd = "H:\\CIV\\KULLDORFF\\DATA\\PLOTDATA.dbf" inputTemplate = "C:\\Program Files (x86)\\ArcGIS\\Desktop10.1\\GraphTemplates\\Default.SimplifiedChinese.tee" output_graph_name = "VerticalBarGraph1" verticalBarGraph_bmp = "H:\\CIV\\KULLDORFF\\DATA\\plotdata1.bmp" # Create the graph graph = arcpy.Graph() # Add a vertical bar series to the graph graph.addSeriesHistogram(simloglkhd, "simloglkhd",10) # Specify the title of the left axis graph.graphAxis = "Frequency" # Specify the title of the bottom axis graph.graphAxis = "log(lambda)" # Specify the title of the Graph graph.graphPropsGeneral.title = "Monte Carlo Distribution of Lambda" # Output a graph, which is created in-memory arcpy.MakeGraph_management(inputTemplate, graph, output_graph_name) # Save the graph as an image arcpy.SaveGraph_management(output_graph_name, verticalBarGraph_bmp, "MAINTAIN_ASPECT_RATIO", "600", "375")
I am having the following difficulties:
I am not able to find a template for this histogram. In the GraphTemplates folder there is PopulationPyramid, but it is still not working. Is there somewhere I can find templates. The create template operation gives a text file instead of a .tee file.
I get an error in the line where I addSeriesHistogram saying "Field '10' is not in the dbf"(something like this) while it is only the countBin. Please can someone tell me where I can find good examples of the usage of this function.
My dbf file is simple ID(1-999) & simloglkhd(floating point numbers).
I really do not know how use this MakeGraph and addSeries_ . I have already read the ArcGIS help. If you can guide me to some more examples and documentation, I would be very grateful.