3

I'm having python produce a multi-series graph. How do you change the series name in the legend, the default being Vertical Bar, Vertical Bar1, Vertical Bar2....

arcpy.MakeGraph_management(graphTemplatePath,'''SERIES=bar:vertical DATA={0} X=ParkUnit Y=Coverage LABEL=ParkUnit SORT=ASC;
                                             SERIES=bar:vertical DATA={1} X=ParkUnit Y=Coverage;
                                             SERIES=bar:vertical DATA={2} X=ParkUnit Y=Coverage;
                                             SERIES=bar:vertical DATA={3} X=ParkUnit Y=Coverage;
                                             SERIES=bar:vertical DATA={4} X=ParkUnit Y=Coverage;
                                             GRAPH=general TITLE={5}, Total Coverage by Unit;
                                             LEGEND=general TITLE=Year Total Coverage;
                                             '''.format(scratchReport + str(year), scratchReport + str(year-1), scratchReport + str(year-2),
                                                        scratchReport + str(year-3), scratchReport + str(year-4), exoticPlant),"graphTemp")
  • I think you might have to do this in the template. I haven't tried this myself but I wonder if you are using the graph in an MXD if it would be possible to access these parameters with arcpy.mapping.ListLayoutElements(). – dango Jan 14 '13 at 8:56
  • i would take a look at the matplotlib library (matplotlib.org). it includes a much more diverse toolbox for creating nice-looking graphs than ESRI currently offers. further, you have much more control over all the variables, if you take the time to examine some examples on the site to learn how to use it effectively. – ndimhypervol Jan 15 '13 at 8:18

Browse other questions tagged or ask your own question.