I'm trying to draw two rectangles (using \fill and a cycle) where only the north/south corners are rounded. I want the blue rectangle below to have rounded corners only on the top, and I want the red rectangle on the bottom to have rounded corners only on the bottom.
Code:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}
\fill [blue,rounded corners=10, draw]
(0,0) --
++(5,0) --
++(0,5) --
++(-5,0) --
cycle
{};
\fill [red,rounded corners=10, draw]
(0,0) --
++(5,0) --
++(0,-5) --
++(-5,0) --
cycle
{};
\end{tikzpicture}
\end{figure}
\end{document}
Can someone help me with this?
These questions might hint on solutions, but I couldn't get it to work with \fill or \draw:
Rounded corners on only one side of a TikZ node
Draw a rectangle with rounded ends in TikZ
TikZ rectangular node with different rounded corners






tcolorboxdoes this out of the box, but perhaps, you want do do other things with your boxes – Apr 27 '16 at 12:31node? – Torbjørn T. Apr 27 '16 at 12:38fitlibrary (see manual). You may not need any of that for your use, of course. – Torbjørn T. Apr 27 '16 at 13:07