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