Skip to content
Snippets Groups Projects
Commit 843a9471 authored by Christoph.Knote's avatar Christoph.Knote
Browse files

Finally, some nice plots. Should be it.

parent ed97e751
No related branches found
No related tags found
No related merge requests found
......@@ -47,8 +47,8 @@ class ExperimentPlotter:
def fluxes(self, spec, fig=None, ax=None,
plot_legend=True, plot_netflux=True, plot_xaxlabels=True,
scale_factor=3600.0 * 1000.0,
xlabel='Time in h', ylabel=r'Flux in ppbv h$^{-1}$', plabel=None,
scale_factor=3600.0 * 1000.0, ylim=None,
xlabel='Time in h', ylabel=r'Flux in ppbv h$^{-1}$', plabel=None, flx_labels = None,
xaxis=True, yaxis=True):
'''
Plot time series of fluxes through a species.
......@@ -67,15 +67,20 @@ class ExperimentPlotter:
netflux = np.zeros(len(times))
for xkey, xvalue in flx.iteritems():
ax.plot(times, xvalue * scale_factor, label=xkey)
try:
ax.plot(times, xvalue * scale_factor, label=flx_labels[xkey]['label'], c=flx_labels[xkey]['color'])
except:
ax.plot(times, xvalue * scale_factor, label=xkey)
netflux += np.array(xvalue)
if plot_netflux:
ax.plot(times, netflux * scale_factor, label="Net flux", lw=2, c='k')
ax.plot(times, np.zeros(len(times)), lw=1, c='gray')
ax.plot(times, netflux * scale_factor, label="Net flux", lw=1, c='k')
ax.grid( alpha=0.5 )
ax.grid( alpha=0.5, color='gray', linestyle='solid' )
ax.plot(times, np.zeros(len(times)), lw=0.5, alpha=0.5, c='dimgray')
ax.set( xlim=(times[0],times[-1]), xlabel=xlabel, ylabel=ylabel)
if not ylim is None:
ax.set( ylim=ylim )
if not plabel is None:
xmin, xmax = ax.get_xlim()
......@@ -84,7 +89,7 @@ class ExperimentPlotter:
horizontalalignment='center', verticalalignment='center')
if plot_legend:
ax.legend(loc='lower center', fontsize="xx-small", fancybox=True, framealpha=0.5)
ax.legend(loc='upper center', fontsize="xx-small", fancybox=True, framealpha=0.75)
if not plot_xaxlabels:
ax.tick_params(labelbottom='off')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment