Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am going to start a project soon where, after the data has been processed in various ways, an output jpg showing a graph of the data should be produced. The workflow is as follows:

1. A feature class with several fields containing various values is created.
2. A radar/bar chart based on several fields within the feature class should be produced
3. Colour the chart according to whether the field value is within a certain threshold e.g. if the threshold for the field CHEM1 is 4, a feature with CHEM1 = 2 will be coloured red, while a feature with CHEM1 = 6 will be yellow.
4. Each unique feature within the feature class should have its own graph i.e. 10 features = 10 graphs
5. The graphs should be saved as jpgs
6. The jpgs should be added as attachments to the geodatabase the feature class is in - not needed at this point but should be kept in mind

I will be automating this process after the initial run, as the new data will be processed monthly and the jpgs generated automatically, so a python script will definitely used. Before I begin though, I am unsure as to which graphing method I should use. I have researched the following options for my approach:

1. Python + ArcPy graphing
2. Python + matplotlib
3. Python + Excel

My pros and cons for each option:

  1. I am used to ArcMap's graphing options, and have been using arcpy and ModelBuilder daily for the past year, so it will be relatively simple for me to use the inbuilt arcpy functionality.
  2. I have never used matplotlib before, but my brief research indicates that it is quite simple to use for basic charts, and it doesn't seem to be that much more difficult to create more advanced charts using it. Also, since it's included with ArcGIS, it seems like a logical choice.
  3. I have worked heavily with Excel for many years, and am very familiar with creating charts in it. I also did VBA, and it is my understanding that after looking at the VBA code for an action, one can translate that into Python quite quickly.

I am leaning towards the third option, since I feel most comfortable with that combination. However, since this process will have to be automated completely and will eventually run on the server, I do not like the idea of having to install Excel on the server so that this process can be run. I also fear that all the arcpy code will slow the process down (from a combination of not having enough experience with the graphing methods, not being able to optimise my code, slow computers in general, network issues), and that even though matplotlib appears to be the simplest/fastest approach, I will end up taking longer writing the code because I have not used it before.

My question is not which combination works the best overall (because that would be subjective/too localised), but which option would be the best combination to achieve the outcome for this particular task?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

This is only a partial answer, as I'm not familiar with ArcPy's graphing capabilities (I'm still at v.9.3.1), so I can't comment on your option 1. However, given the choice between options 2 and 3 I'd definitely tend towards 2 (Python and Matplotlib).

It's difficult to comment without knowing exactly what you're doing, but it sounds as though a straightforward solution should be possible using Python. Introducing VBA seems like an extra complication, and in my experience plots with Matplotlib are vastly superior to anything that Excel can produce.

Based on your described workflow, I'd suggest something like the following:

  1. Use a Search Cursor to read the relevant parts of your feature class into Python.
  2. Implement all your classification logic etc. in Python and plot the data using Matplotlib.
  3. Save your JPEGs to the desired location.
  4. If you want to, use an Update Cursor to add the JPEG paths as attributes in a new field in the feature class. This will allow you to hyperlink the JPEGs directly from ArcMap.

If you're already familiar with Excel and VBA then the Matplotlib route may take longer, but it's a package well worth learning and the documentation is excellent.

share|improve this answer
    
My main concern was performing the conditional colouring of the chart (point 3 of my workflow), but now that you have pointed it out that I can do it in Python (that should have been more obvious to me), matplotlib is looking more promising. Also I didn't mean that I would use VBA with Excel, I was just mentioning that I had done VBA, so translating it into python would have a been a bit easier. I don't have the sample data yet which is why I couldn't really explain more of what I want to do, but I think your way is the way to go. –  Arabella May 6 '13 at 10:37
    
Sorry - my mistake. It's clear from your post that you weren't planning to use VBA directly. Nonetheless, if you already have some familiarity with Python I'd recommend going straight for Matplotlib. I doubt it will be much slower/harder than translating from VBA, and your finished code will likely be a lot cleaner. Good luck! –  JamesS May 6 '13 at 10:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.