"\n", ) return "".join(outline) + "\n" + self._df.__union__() #### TESTING ### if __name__ == "__main__": ### Be careful when generating test data from Pandas Index/DataFrame objects, as this module has overwritten their defaul behavior ### best to generate them in other modules and import them to simulate realisitc usec ase spec = SpecIndex([400.0, 500.0, 600.0]) testdates = date_range(start="3/3/12", periods=3, freq="h") ts = TimeSpectra(abs(randn(3, 3)), columns=testdates, index=spec, timeunit="s", baseline=[1.0, 2.0, 3.0]) range_timeplot(ts) ts.a = 50 ts.b = "as" ts.iunit = "t" ts.list_attr(dfattr=False, methods=False, types=True) ts.as_iunit("a") x = ts.as_iunit("a") # ts.as_interval() # spec_surface3d(ts) ##Not working because of axis format problem # plt.show() # ts.rank(use_base=True) x = ts.dumps() ts = mloads(x)
def quad_plot(ts, *plotargs, **plotkwds): """ Output a matplotlib figure with full spectra, absorbance, area and stripchart. Figure should be plotly convertable through py.iplot_mpl(fig) assuming one is signed in to plotly through py.sign_in(user, apikey). Parameters ----------- title : str Title of the overall figure striplegend : bool (False) Add a legend to the strip chart colormap : string ('jet') Colormap applied to full and absorbance spectra. 'Jet' is applid to strip chart regardless. tight_layout: bool (False) Calls mpl.fig.tight_layout() """ title = plotkwds.pop('title', '') tight_layout = plotkwds.pop('tight_layout', False) f, axes = put.splot(2,2, fig=True, figsize=(8,8)) f.suptitle(title, fontsize=20) if tight_layout: f.tight_layout() cmap = plotkwds.pop('colormap', 'jet') strip_cmap = 'spectral' striplegend = plotkwds.pop('striplegend', False) specplot(ts, *plotargs, ax=axes[0], title='Spectra', colormap = cmap, fig=f, #for colorbar **plotkwds) range_timeplot(ts.wavelength_slices(8), ax=axes[1], legend=False, colormap = strip_cmap, title='Spectral Slices', **plotkwds) normplot(ts, *plotargs, ax=axes[2], colormap=cmap, title='Normalized', **plotkwds) areaplot(ts, *plotargs, ax=axes[3], title='Area', fig=f, **plotkwds) # Custom legend to strip chart (http://matplotlib.org/users/legend_guide.html#multicolumn-legend) if striplegend: axes[1].legend(loc='lower center', ncol=4, fontsize=5, # mode='expand', bbox_to_anchor=(0.5,-0.1)) for a in (axes[1], axes[3]): a.yaxis.tick_right() a.yaxis.set_label_position("right") # Remove y-axis of area/stripchart put.hide_axis(axes[0], axis='x') put.hide_axis(axes[1], axis='x') #axes[1].get_yaxis().set_ticklabels([])#set_visible(False) #axes[3].get_yaxis().set_ticklabels([]) #axes[0].get_xaxis().set_ticklabels([]) #axes[1].get_xaxis().set_ticklabels([]) return f
def quad_plot(ts, *plotargs, **plotkwds): """ Output a matplotlib figure with full spectra, absorbance, area and stripchart. Figure should be plotly convertable through py.iplot_mpl(fig) assuming one is signed in to plotly through py.sign_in(user, apikey). Parameters ----------- title : str Title of the overall figure striplegend : bool (False) Add a legend to the strip chart colormap : string ('jet') Colormap applied to full and absorbance spectra. 'Jet' is applid to strip chart regardless. tight_layout: bool (False) Calls mpl.fig.tight_layout() """ title = plotkwds.pop('title', '') tight_layout = plotkwds.pop('tight_layout', False) f, axes = put.splot(2, 2, fig=True, figsize=(8, 8)) f.suptitle(title, fontsize=20) if tight_layout: f.tight_layout() cmap = plotkwds.pop('colormap', 'jet') strip_cmap = 'spectral' striplegend = plotkwds.pop('striplegend', False) ts.plot( *plotargs, ax=axes[0], title='Spectra', colormap=cmap, fig=f, #for colorbar **plotkwds) range_timeplot(ts.wavelength_slices(8), ax=axes[1], legend=False, colormap=strip_cmap, title='Spectral Slices', **plotkwds) ts.plot(*plotargs, iunit='r', ax=axes[2], colormap=cmap, title='Normalized', **plotkwds) areaplot(ts, *plotargs, ax=axes[3], title='Area', fig=f, **plotkwds) # Custom legend to strip chart (http://matplotlib.org/users/legend_guide.html#multicolumn-legend) if striplegend: axes[1].legend( loc='lower center', ncol=4, fontsize=5, # mode='expand', bbox_to_anchor=(0.5, -0.1)) for a in (axes[1], axes[3]): a.yaxis.tick_right() a.yaxis.set_label_position("right") # Remove y-axis of area/stripchart put.hide_axis(axes[0], axis='x') put.hide_axis(axes[1], axis='x') #axes[1].get_yaxis().set_ticklabels([])#set_visible(False) #axes[3].get_yaxis().set_ticklabels([]) #axes[0].get_xaxis().set_ticklabels([]) #axes[1].get_xaxis().set_ticklabels([]) return f