def plot_number_observer_with_nya(obs, config=None, width=<NUM_LIT>, height=<NUM_LIT>, x=None, y=None, to_png=False):
config = config or {}<EOL>from IPython.core.display import display, HTML<EOL>import numpy<EOL>config = {}<EOL>color_scale = default_color_scale(config=config)<EOL>data1, data2 = [], []<EOL>data = numpy.array(obs.data())<EOL>if x is None:<EOL><INDENT>xidx = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>tmp = [sp.serial() for sp in obs.targets()]<EOL>if x not in tmp:<EOL><INDENT>raise ValueError("<STR_LIT>".fomrat(x))<EOL><DEDENT>xidx = tmp.index(x) + <NUM_LIT:1><EOL><DEDENT>if y is None:<EOL><INDENT>targets = [sp.serial() for sp in obs.targets()]<EOL>targets = list(enumerate(targets))<EOL><DEDENT>else:<EOL><INDENT>if isinstance(y, str):<EOL><INDENT>y = (y, )<EOL><DEDENT>targets = [sp.serial() for sp in obs.targets()]<EOL>targets = [(targets.index(serial), serial)<EOL>for serial in y if serial in targets]<EOL><DEDENT>for line in data:<EOL><INDENT>tmp = {"<STR_LIT:x>": line[xidx]}<EOL>for i, (idx, serial) in enumerate(targets):<EOL><INDENT>tmp["<STR_LIT>".format(i + <NUM_LIT:1>)] = line[idx + <NUM_LIT:1>]<EOL><DEDENT>data1.append(tmp)<EOL><DEDENT>for i, (idx, serial) in enumerate(targets):<EOL><INDENT>label = serial<EOL>tmp = {"<STR_LIT:type>": "<STR_LIT>", "<STR_LIT:data>": "<STR_LIT>",<EOL>"<STR_LIT>": {"<STR_LIT:x>": "<STR_LIT:x>", "<STR_LIT:y>": "<STR_LIT>".format(i + <NUM_LIT:1>),<EOL>"<STR_LIT>": <NUM_LIT:2>, "<STR_LIT:title>": label,<EOL>"<STR_LIT>": color_scale.get_color(label)}}<EOL>data2.append(tmp)<EOL><DEDENT>xmin, xmax = data.T[xidx].min(), data.T[xidx].max()<EOL>yview = data.T.take([idx + <NUM_LIT:1> for idx, serial in targets], axis=<NUM_LIT:0>)<EOL>ymin, ymax = yview.min(), yview.max()<EOL>model = {<EOL>"<STR_LIT:data>": {"<STR_LIT>": data1},<EOL>"<STR_LIT>": [{"<STR_LIT:type>": '<STR_LIT>',<EOL>"<STR_LIT>": data2,<EOL>"<STR_LIT>": {"<STR_LIT:width>": width, "<STR_LIT>": height, "<STR_LIT>": [xmin, xmax],<EOL>"<STR_LIT>": [ymin, ymax], "<STR_LIT>": True, "<STR_LIT>": True}}]}<EOL>model_id = '<STR_LIT>'.format(str(uuid.uuid4()))<EOL>display(HTML(generate_html(<EOL>{'<STR_LIT>': json.dumps(model), '<STR_LIT>': model_id, '<STR_LIT>': json.dumps(to_png)},<EOL>'<STR_LIT>')))<EOL>
Generate a plot from NumberObservers and show it on IPython notebook
with nyaplot.

Parameters
----------
obs : NumberObserver (e.g. FixedIntervalNumberObserver)
config : dict, optional
    A config data for coloring. The dictionary will be updated during this plot.
width : int, optional
height : int, optional
x : str, optional
    A serial for x-axis. If None, x-axis corresponds time.
y : str or list of str
    Serials for y axis.