Example #1
0
# all of the data set types
data_types = [
    'xy', 'xydx', 'xydy', 'xydxdy', 'xydydy', 'xydxdx', 'xydxdxdydy', 'bar',
    'bardy', 'bardydy', 'xyhilo', 'xyz', 'xysize', 'xycolor', 'xyvmap',
    'xyboxplot'
]
n_components = [2, 3, 3, 4, 4, 4, 6, 2, 3, 4, 5, 3, 3, 3, 4, 6]

from random import random, randint

# make an instance of the Grace class that uses RandomColorScheme
seed = randint(0, 10000)
colors = RandomColorScheme(seed, len(data_types))
# colors = MarkovChainColorScheme(seed,len(data_types))
grace = MultiPanelGrace(colors=colors)

# specify the label scheme
grace.add_label_scheme("my_scheme", data_types)
grace.set_label_scheme("my_scheme")

# add a Graph as a "child" of the grace instance
for i in range(len(data_types)):
    graph = grace.add_graph(Panel)

    # customize the panel label scheme
    graph.panel_label.configure(dx=0.02, dy=0.02, placement="iul")

    # add a simple DataSet as a "child" of the graph instance.  A list
    # of data is always the required first argument to add_dataset.
    data = []
Example #2
0
from PyGrace.Extensions.panel import Panel, MultiPanelGrace
from PyGrace.Styles.el import ElCircleDataSet
from PyGrace.Styles.journals import NaturePanelLabel

import example_tools
dataList = example_tools.panels()

# This example illustrates some features that exist for multigraphs,
# including methods which hide redundant labels on axes.  This also
# illustrates the use of panels which automatically come with a panel
# label.

# make an instance of the Grace class
grace = MultiPanelGrace()

# add a Graph as a "child" of the grace instance
for data in dataList:
    graph = grace.add_graph(Panel)

    # configure placement of panel label
    graph.panel_label.copy_format(NaturePanelLabel)

    # configure placement of panel label
    graph.panel_label.configure(placement="our", dx=0.01, dy=0.01)

    # add a simple DataSet as a "child" of the graph instance.  A list
    # of data is always the required first argument to add_dataset.
    dataset = graph.add_dataset(data, ElCircleDataSet, 1)

    # ticklabels
    graph.xaxis.ticklabel.configure(format="decimal", prec=1)