Using the GP tools and python it is possible to dynamically create a graph in ArcMap but how can I display the graph to the user?
Regardless of how the graph is made, either manually or via a script, I think you still have to open the graph in ArcMap.
View / Graph and then pick it.
If you are creating the graph using arcpy / python, is this happening within an open ArcMap mxd?
Yes it is possible. It's probably not as straight-forward as you might be expecting though. For our implementation(s), we employ the matplotlib library to generate our graphs, save as .png and then populate File Geodatabase(s) as attachments to their related FeatureClasses.
I couldn't really begin to post up any code examples unless you have something specific in mind. Post up an example of your data.
Workflow would be as follows. User has an ArcMap document open in which a NetCDF Raster layer is visible. The user clicks on a location to view how a variable changes over time or levels. All the steps can be scripted using python, GP tools and a graph template except for the final step of displaying the graph to the user. Am I missing something?
Here's a short example using matplotlib (although there are probably far better examples found with a quick Google search or on Stack Overflow).
H:\GraphData.csv Month Values0 1 2.02281 2 2.02292 3 2.02313 4 2.02324 5 2.02335 6 2.02346 7 2.02357 8 2.02368 9 2.02379 10 2.023710 11 2.023811 12 2.023912 13 2.024013 14 2.024114 15 2.024315 16 2.024416 17 2.024717 18 2.024718 19 2.024819 20 2.024920 21 2.025021 22 2.025022 23 2.025223 24 2.0253
import pandas as pd
from pandas import *
import matplotlib.pyplot as plt
data = r'H:\GraphData.csv'
df = pd.io.parsers.read_table(data, sep=',')
xs = df.Month
ys = df['Values']
min = df['Month'].min()
max = df['Month'].max()
fig = plt.figure()
ax = "ax" + str(211)
ax = fig.add_subplot(211, axisbg='white')
ax.plot(xs, ys, linestyle='-', marker='', linewidth=1, color='blue', label=str('Graph Test'))
I posted a document a while ago with an example of creating a profile graph with matplotlib:
Using Python and matplotlib to create profile graphs
Dan Patterson has some valuable posts on this topic too:
Collections in numpy: producing frequency distributions and graphing and X-Y graphing demo using pyplot (matplotlib)...an introduction
Retrieving data ...