Antonino Ingargiola added plotting_data.tex  about 8 years ago

Commit id: fd948a8ba7abe489d24041575d86731f4880afd5

deletions | additions      

         

\section{Plotting \texttt{Data}}  \label{sec:plotting}  FRETBursts uses  matplotlib~\cite{matplotlib}  and seaborn~\cite{seaborn}  to provide a wide range of built-in plot functions  (\href{http://fretbursts.readthedocs.org/en/latest/plots.html}{link})  for \verb|Data| objects.  The plot syntax is the same for both single and multi-spot measurements.  The majority of plot commands are called through the wrapper function  \verb|dplot|, for example to plot a timetrace of the photon data, type:  \begin{lstlisting}  dplot(d, timetrace)  \end{lstlisting}  The function \verb|dplot| is the generic plot function, which creates figure  and handles details common to all the plotting functions (for instance, the title).  \verb|d| is the \verb|Data| variable and \verb|timetrace| is the actual plot  function, which operates on a single channel. In multispot measurements,  \verb|dplot| creates one subplot for each spot and calls \verb|timetrace| for  each channel.  All built-in plot functions which can be passed to  \verb|dplot| are defined in the  \verb|burst_plot| module  (\href{http://fretbursts.readthedocs.org/en/latest/plots.html}{link}).  \paragraph{Python details}  When FRETBursts is imported, all plot functions are also imported.  To facilitate finding the plot functions through auto-completion,  their names start with a standard prefix indicating the  plot type. The prefixes are: \verb|timetrace| for binned timetraces  of photon data, \verb|ratetrace| for rates of photons as a function of time (non  binnned), \verb|hist| for functions plotting histograms and \verb|scatter| for  scatter plots.  Additional plots can be easily created directly with matplotlib.  By default, in order to speed-up batch processing, FRETBursts notebooks display plots  as static images using the \textit{inline} matplotlib backend.  User can switch to interactive figures inside the browser by activating  the interactive backend with the command \verb|%matplotlib notebook|.  Another option is displaying figures in a new standalone window  using a desktop graphical library such as QT4.  In this case, the command to be used is \verb|%matplotlib qt|.  A few plot functions, such as \verb|timetrace| and \verb|hist2d_alex|, have interactive features  which require the QT4 backend. As an example, after switching to the QT4 backend  the following command:  \begin{lstlisting}  dplot(d, timetrace, scroll=True, bursts=True)  \end{lstlisting}  \noindent  will open a new window with a timetrace plot with overlay of bursts, and an horizontal scroll-bar for quick  "scrolling" throughout time. The user can click on a burst to have the corresponding burst info  be printed in the notebook.  Similarly, calling the \verb|hist2d_alex| function with the QT4 backend allows  selecting an area on the E-S histogram using the mouse.  \begin{lstlisting}  dplot(ds, hist2d_alex, gui_sel=True)  \end{lstlisting}  The values which identify the region are printed in the notebook and can be passed  to the function \verb|select_bursts.ES| to select bursts inside that region  (see section~\ref{sec:burstsel}).