TransWikia.com

How can I obtain a closed curve in Tikz where part of it is smooth

TeX - LaTeX Asked on May 14, 2021

Using commands as shown in the answers to this question, one can obtain a closed, smooth cycle. Copying the example :

begin{tikzpicture}
draw [red] plot [smooth cycle] coordinates {(0,0) (1,1) (3,1) (1,0) (2,-1)};
end{tikzpicture}

enter image description here

Consider that you want only part of the closed cycle to be smooth, e.g. this figure :

enter image description here

What should you change in the code?

It is preferred to have one command that provides a closed cycle, so one can fill it afterwards.

One Answer

You can embed a smooth plot in a non-smooth path.

documentclass[tikz,border=3mm]{standalone}
begin{document}
begin{tikzpicture}
draw [red] (1,0) -- plot [smooth] coordinates { (2,-1) (0,0) (1,1) (3,1)  } --cycle;
end{tikzpicture}
end{document}

enter image description here

Correct answer by user228539 on May 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP