From the wiki manual:
Show Selected Only
- By default, the Graph Editor shows the channels for the active object only. Toggle this button off to show channels for all objects.
- Enable this to show channels from objects/bones that are hidden.
Show only matching F-Curves
- Use this to only include F-Curves that contain the specified text.
- Show options for whether channels related to certain types of data are included.
If you want to change these settings you should have a look at
If you are using an operator which will be called from the graph editor, the space data is available from
space = context.space_data
dopesheet = space.dopesheet
dopesheet.show_only_selected = True
#select the objects you want to show
obj.select = True
#show only objects from the group named 'Group'
dopesheet.filter_group = bpy.data.groups['Group']
dopesheet.show_only_group_objects = True
#don't show object transformations and scene properties
dopesheet.show_transforms = False
dopesheet.show_scenes = False
Hide a fcurve:
#only accessible by index
fcurve = obj.animation_data.action.fcurves.hide = True
#fcurve's attributes data_path, array_index provide more information about it
or select it:
fcurve = obj.animation_data.action.fcurves.select = True
If the object has not been animated:
The minimum requirement to show up in the graph curve is existent animation data with an action assigned to it which possesses at least one fcurve.
So if the object has not been animated yet:
if not obj.animation_data:
obj.animation_data.action = bpy.data.actions.new('myAction')
#create an fcurve for the x coordinate