\begin{tikzpicture}

% Define colors
\definecolor{idlecolor}{RGB}{255, 204, 153} % Light orange
\definecolor{refcolor}{RGB}{153, 204, 255} % Light blue
\definecolor{backgroundcolor}{RGB}{255, 255, 153} % Light yellow

\newcommand{\ya}{1}
\newcommand{\yb}{2.6}
\newcommand{\yc}{6}

\pgfdeclarelayer{background}
\pgfsetlayers{background, main}
% Define the axis
\begin{axis}[
    %width=15cm, height=8cm,
    xlabel={Time},
    ylabel={Current},
    xmin=0, xmax=6,
    ymin=0, ymax=7,
    xtick=\empty,
    ytick=\empty,
    extra y ticks={\ya, \yb, \yc},
    extra y tick labels={$I_{DD2N}$, $I_{DD5A}$, $I_{DD5B}$},
    axis x line=middle,
    axis y line=middle,
    y axis line style={-Latex},
    x axis line style={-Latex},
    axis line style=thick,
    ylabel near ticks,
    xlabel near ticks,
]
% Shaded areas
%% IDLE energy (orange stripes)
%\addplot[domain=0:3.3, fill=idlecolor, pattern=north east lines, draw=none] {1.5} \closedcycle;
\begin{pgfonlayer}{background}
\draw[pattern=north east lines, pattern color=red!50, draw=none] (axis cs:1,\ya) rectangle (axis cs:2,\yc);
\draw[pattern=north east lines, pattern color=red!50, draw=none] (axis cs:4,\ya) rectangle (axis cs:5,\yc);
\draw[pattern=north east lines, pattern color=green!50, draw=none] (axis cs:0,0) rectangle (axis cs:6,1);
\draw[pattern=north west lines, pattern color=blue!50, draw=none] (axis cs:0,\ya) rectangle (axis cs:6,\yb);
\end{pgfonlayer}
%\addplot[domain=3.7:7, fill=idlecolor, pattern=north east lines, draw=none] {1.5} \closedcycle;
%\addplot[domain=7.4:10, fill=idlecolor, pattern=north east lines, draw=none] {1.5} \closedcycle;
%% IDD5PB_B Background energy (yellow stripes)
%\addplot[domain=0:3.3, fill=backgroundcolor, pattern=north west lines, draw=none] {2.5} \closedcycle;
%\addplot[domain=3.7:7, fill=backgroundcolor, pattern=north west lines, draw=none] {2.5} \closedcycle;
%\addplot[domain=7.4:10, fill=backgroundcolor, pattern=north west lines, draw=none] {2.5} \closedcycle;
%% REFpb Foreground energy (blue stripes)
%\addplot[domain=1:2.3, fill=refcolor, pattern=north east lines, draw=none] {4.5} \closedcycle;
%\addplot[domain=4.7:6, fill=refcolor, pattern=north east lines, draw=none] {4.5} \closedcycle;
%\addplot[domain=7.7:9, fill=refcolor, pattern=north east lines, draw=none] {4.5} \closedcycle;
% Plot the current curve (in blue)
%\addplot[domain=0:10, samples=100, thick, blue] 
%    ({x}, {x < 1 || (x > 3 && x < 4.7) || x > 7.4 ? 2.5 : 
%           (x >= 1 && x <= 2.3) || (x >= 4.7 && x <= 6) || (x >= 7.7 && x <= 9) ? 
%           4.5 : 1.5}) ;
\addplot[thick] coordinates {(0,\ya) (1,\ya)};
\addplot[thick] coordinates {(1,\ya) (1,\yc)};
\addplot[thick] coordinates {(1,\yc) (2,\yc)};
\addplot[thick] coordinates {(2,\yc) (2,\ya)};
\addplot[thick] coordinates {(2,\ya) (4,\ya)};
\addplot[thick] coordinates {(4,\ya) (4,\yc)};
\addplot[thick] coordinates {(4,\yc) (5,\yc)};
\addplot[thick] coordinates {(5,\yc) (5,\ya)};
\addplot[thick] coordinates {(5,\ya) (6,\ya)};
% Mark important points (IDD5PB, IDD5PB_B, I0, IDD2N levels)
\addplot[dashed] coordinates {(0,\ya) (6,\ya)}; % IDD2N
\addplot[dashed] coordinates {(0,\yb) (6,\yb)}; % IDD5PB
\addplot[dashed] coordinates {(0,\yc) (6,\yc)}; % IDD5PB_B
% Text Annotations
%\node[align=left] at (axis cs:9.8,5.8) {\textbf{IDD5B}};
%\node[align=left] at (axis cs:9.8,4.3) {\textbf{IDD5A}};
%%\node[align=left] at (axis cs:9.8,2.3) {\textbf{I\_0}};
%\node[align=left] at (axis cs:9.8,1.3) {\textbf{IDD2N}};
% Labels for periods tRFCpb and tREFI8
\draw[thick, {Latex}-{Latex}] (axis cs:1,5) -- (axis cs:2,5) node[midway,below] {$t_{RFC}$};
%\draw[thick, {Latex}-{Latex}] (axis cs:4,5) -- (axis cs:5,5) node[midway,below] {$tRFC$};
\draw[thick, {Latex}-{Latex}] (axis cs:1,4) -- (axis cs:4,4) node[midway,below] {$t_{REFI}$};
%\draw[thick, <->] (axis cs:1,0.5) -- (axis cs:2.3,0.5) node[midway,below] {$tRFC_{pb}$};
%\draw[thick, <->] (axis cs:0,0.5) -- (axis cs:3.3,0.5) node[midway,below] {$tREFI8$};
%\draw[thick, <->] (axis cs:4.7,0.5) -- (axis cs:6,0.5) node[midway,below] {$tRFC_{pb}$};
%\draw[thick, <->] (axis cs:3.7,0.5) -- (axis cs:7,0.5) node[midway,below] {$tREFI8$};
%\draw[thick, <->] (axis cs:7.7,0.5) -- (axis cs:9,0.5) node[midway,below] {$tRFC_{pb}$};
%\draw[thick, <->] (axis cs:7.4,0.5) -- (axis cs:10,0.5) node[midway,below] {$tREFI8$};
\end{axis}
% Legend
\begin{scope}
    \node[draw, pattern=north east lines, pattern color=green!50] at (0.0,-1) {~};
    \node[anchor=west] at (0.2,-1) {Background Energy};
    \node[draw,pattern=north east lines, pattern color=red!50] at (3.8,-1) {~};
    \node[anchor=west] at (4.0,-1) {Burst Refresh Energy};
    \node[draw,pattern=north west lines, pattern color=blue!50] at (0.0,-1.5) {~};
    \node[anchor=west] at (0.2,-1.5) {Average Refresh Energy};
\end{scope}
%\draw[pattern=north east lines, pattern color=red!50, draw=none] (axis cs:1,1) rectangle (axis cs:2,6);
%\draw[pattern=north east lines, pattern color=red!50, draw=none] (axis cs:4,1) rectangle (axis cs:5,6);
%\draw[pattern=north east lines, pattern color=green!50, draw=none] (axis cs:0,0) rectangle (axis cs:6,1);
%
\end{tikzpicture}%