Plotting profile plots from the MEA example¶
Warning
The following has not been tested recently and should be considered a work in progress.
The following examples demonstrate the resize, annotation and saving functionalities.
In the following example, we being by preparing a data frame from our flowsheet variables.
# Absorber CO2 Levels
from pandas import DataFrame
import os
tmp = fs.absorb.make_profile(t=0)
tmp = fs.regen.make_profile(t=0)
plot_dict = {'z':fs.absorb.profile_1['z'],
'y1':fs.absorb.profile_1.y_vap_CO2*101325.0,
'y2':fs.absorb.profile_1.P_star_CO2}
plot_data_frame = DataFrame(data=plot_dict)
We can then plot the data frame we just made, show it, resize it and save it.
absorber_co2_plot = Plot.profile(plot_data_frame,
x = 'z',
y = ['y1','y2'],
title = 'Absorber CO2 Levels',
xlab = 'Axial distance from top (m)',
ylab = 'Partial Pressure CO2 (Pa)',
legend = ['Bulk vapor','Equilibrium'])
absorber_co2_plot.show()
absorber_co2_plot.save('/home/jovyan/model_contrib/absorber_co2_plot.html')
assert(os.path.isfile('/home/jovyan/model_contrib/absorber_co2_plot.html'))
absorber_co2_plot.resize(height=400,width=600)
absorber_co2_plot.show()
absorber_co2_plot.save('/home/jovyan/model_contrib/absorber_co2_plot_resized.html')
assert(os.path.isfile('/home/jovyan/model_contrib/absorber_co2_plot_resized.html'))
The following demonstrates the annotate functionality by plotting a second plot from the same flowsheet.
from IPython.core.display import display,HTML
stripper_co2_plot = Plot.profile(plot_data_frame,
x = 'z',
y = ['y1','y2'],
title = 'Stripper CO2 Levels',
xlab = 'Axial distance from top (m)',
ylab = 'Partial Pressure CO2 (Pa)',
legend = ['Bulk vapor','Equilibrium'])
stripper_co2_plot.show()
stripper_co2_plot.save('/home/jovyan/model_contrib/stripper_co2_plot.html')
assert(os.path.isfile('/home/jovyan/model_contrib/stripper_co2_plot.html'))
We can then annotate the “Reboiler vapor” point as shown below:
stripper_co2_plot.annotate(rloc,rco2p,'Reboiler vapor')
stripper_co2_plot.show()
stripper_co2_plot.save('/home/jovyan/model_contrib/stripper_co2_plot_annotated.html')