Hi Matt/all,

You might be able to just make yt treat your multiple data sets as a time series, and plot using those tools:

https://yt-project.org/docs/dev/cookbook/simple_plots.html#d-profiles-over-time

Best,
Stephanie

--
Dr. Stephanie Tonnesen
Associate Research Scientist
CCA, Flatiron Institute
New York, NY

stonnes@gmail.com


On Tue, May 28, 2019 at 12:24 PM Cameron Hummels <chummels@gmail.com> wrote:
Hi Matt,

It doesn't look like there is currently support for overplotting lines from different datasets.  I imagine a little bit of work would make this possible by making the LinePlot instance use an existing Matplotlib axis object, and just having it use that twice for two subsequent LinePlots?  It would take modifying code around here: https://github.com/yt-project/yt/blob/master/yt/visualization/line_plot.py#L332 , I think.  But perhaps someone else has other suggestions?

Cameron

On Mon, May 27, 2019 at 8:06 AM <matt@seaborg.co> wrote:
Hi, I couldn't find such a thread anywhere and I hope you are able to help me... I'm trying to visualize some data from Exodus II format using LinePlot.from_lines but I have no clue how to combine two different datasets in order to put everything into one plot. Basically I load one output file to one dataset and the second to another one, then I add lines using lines.append. How to plot things from two datasets in one graph?
My code is:

import yt
import numpy as np
from yt.units import K

home = "/home/peppe"

def _units(field, data):
    return data[('all', 'temp')] * K


ds = yt.load(
    home + '/projects/2out.e', step=-1)
ds.add_field(('all', 'temp_K'), units='K', function=_units, take_log=False)

es = yt.load(
    home + '/projects/4out.e', step=-1)
es.add_field(('all', 'temp_K'), units='K', function=_units, take_log=False)
lines = []
lines.append(yt.LineBuffer(
    es, (0, 0, 0), (0, 162.56, 0), 1000, label='fuel 4g'))
lines.append(yt.LineBuffer(es, (3, 0, 0), (3, 162.56, 0),
                           1000, label='mod 4g'))
lines.append(yt.LineBuffer(
    ds, (0, 0, 0), (0, 162.56, 0), 1000, label='fuel 2g'))
lines.append(yt.LineBuffer(ds, (3, 0, 0), (3, 162.56, 0),
                           1000, label='mod 2g'))
plt = yt.LinePlot.from_lines(es, [('all', 'temp_K')], lines, field_labels={
                             ('all', 'temp_K'): ''})
plt = yt.LinePlot.from_lines(ds, [('all', 'temp_K')], lines, field_labels={
                             ('all', 'temp_K'): ''})
plt._setup_plots()
plt.annotate_legend(('all', 'temp_K'))
plt.set_x_unit('cm')
plt.set_xlabel('z (cm)')
plt.set_ylabel('Temperature (K)')
plt.save(home + '/projects/plot.jpg')
_______________________________________________
yt-users mailing list -- yt-users@python.org
To unsubscribe send an email to yt-users-leave@python.org


--
Cameron Hummels
NSF Postdoctoral Fellow
Department of Astronomy
California Institute of Technology
_______________________________________________
yt-users mailing list -- yt-users@python.org
To unsubscribe send an email to yt-users-leave@python.org