5

With help of the intersections library: \documentclass[border=3.141592]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture}[ dot/.style = {circle, draw, solid, fill=gray, inner sep=1.6pt, node contents={}}, ] \begin{axis}[name=plot1, declare ...


4

You can use intersection segments as explained in the pgfplots manual, Intersection Segment Recombination (section 5.7.6 for manual revision 1.17, 2020/02/29). In the code below, sequence=R1 -- L2 means we connect the first intersection segment of the second input path (path denoted by R in this context) to the second intersection segment of the first input ...


4

I have just uploaded a new version of my package spath3 to CTAN which provides a few commands for manipulating TikZ/PGF paths after they have been constructed. These include the ability to split a path at the points where it intersects with another path. Using this together with a command that splits a path into its components, it is possible to construct ...


4

I would draw your diagram on the following way: \documentclass[11pt, border=3.141592]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.16} % recent is 1.18 \usetikzlibrary{intersections} \usepackage{mathrsfs} \begin{document} \begin{tikzpicture}[ dot/.style = {circle, fill, semitransparent, inner sep=2pt}, every pin/.style = {pin edge={...


3

While you are waiting for a pgfplots answer, here is a Metapost version, showing the useful cutbefore and cutafter functions for trimming paths. \documentclass[border=5mm]{standalone} \usepackage{luamplib} \begin{document} \mplibtextextlabel{enable} \begin{mplibcode} beginfig(1); numeric u, v; u = 5; v = 6; path R, B, G; R = ((0,0) -- (15,30) -- (30,33) -- ...


3

Amusingly enough, when I copied your code to save as a TeX document to play around with then I tried to save it as pgfplotsforeach.tex only to discover that I already have a file with that name as the answer to \pgfmathsetmacro isn't setting the macro. I'm guessing that you have also seen that question because you have the \edef\temp{...}\temp in your \...


3

First of make sure your MWE actually compiles, here \begin{document} and the tikz lib calc are missing. Secondly, the problem here is that in \path[shorten <= -0.5cm,-, name path=path3] the shorten part does not add to the length of the path (the part that can be used for calculations), it only adds to the displayed version. Thus the line segment used to ...


3

Here's a solution using version 2.0 of the spath3 library that introduces some methods for manipulating TikZ/PGF paths. In particular, it can split a path at intersection points and then recombine them to define the region you want to fill (including reversing them if needed). \documentclass{article} %\url{https://tex.stackexchange.com/q/516723/86} \...


2

Version 2.0 of the spath3 package introduces routines to split curves at intersection points and then render their components with different styles. Using that, your diagram can be coded as follows. Note that to get the crossing effect I insert actual gaps in the paths rather than using the wipe-out technique. \documentclass{article} %\url{https://tex....


2

Here's a solution using the latest version of the spath3 library (at time of writing this needs the development version but it will be uploaded to CTAN once it has undergone a bit more testing). I've commented the code to explain what's going on, but the basic idea is as follows: Define and save all the edges Iterate through all pairs of edges to find the ...


2

I must confess to being slightly confused as to why the extra line appears (I suspect a stray closepath in the underlying soft path), but anyway here's code using version 2.0 of the spath3 package that splits the paths in the right places. \documentclass{article} %\url{https://tex.stackexchange.com/q/287401/86} \usepackage{tikz} \usetikzlibrary{...


2

You need to name x axis, for example with x axis line style={name path=<name>}, % <--- in axis preamble and then you can write: \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.17} \usetikzlibrary{arrows.meta, babel,backgrounds, calc, intersections} \...


2

My spath3 TikZ library can handle this. It's not clear if you want the components put together into a single path or you want them to stay separate (so that, for example, they can be differently coloured). In this code, I've put them together. \documentclass{article} %\url{https://tex.stackexchange.com/q/585049/86} \pagestyle{empty} \usepackage{tikz} \...


2

I encourage you to upgrade your ˙pgfplots` installation (it is not crucial to find third intersection, but anyway, it is worth to do so) I guessing, that you like to obtain the following graph: In comparison to your MWE I only add fourth segment in drawing red lines and use recent syntax enabled with pgfplots after version 1.11: \documentclass[border=3....


2

You can find some examples in TikZ documentation: pages 145-146 \documentclass[tikz,border=2mm]{standalone} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture}[domain=0:10] \draw[->] (-0.2,0) -- (10.2,0) node[right] {$t$}; \draw[->] (0,-1.4) -- (0,1.4) node[above] {$x(t)$}; \draw[color=orange, dashed, name path=plotA] plot (\x,0.75) ...


2

I'm not sure of what you need. If it's something like your picture, but with x,y axes, you can do the following: \documentclass[tikz, border=2mm]{standalone} \begin{document} \begin{tikzpicture}[scale=0.5] \draw[blue,very thin] (-8.5,-8.5) grid (8.5,8.5); \draw[thick,->] (-10, 0) -- (10, 0) node[right] {$x$}; \draw[thick,->] (0, -10) -- (0, 10) ...


2

You can achieve the desired result with the help of intersection segments from the fillbetween library. If show it with some debug code so it is a bit easier to follow what is happening. % used PGFPlots v1.18.1 \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \usepgfplotslibrary{fillbetween} \begin{document} \begin{tikzpicture} \begin{...


2

A solution with clip. \documentclass{minimal} \usepackage{tikz,pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis} \begin{scope} \clip (0,20) -- (30,0) -- (60,0) -- (60,35) -| cycle; \clip (0,10) -- (30,10) -- (60,25) -- (60,35) -| cycle; \addplot[red] coordinates {(0,0)(15,30)(30,33)(45,28)(60,10)...


2

\documentclass[tikz,border=3.14mm]{standalone} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture} \draw[help lines] (0, 0) grid (5, 5); \coordinate (A) at (0, 5); \coordinate[label=below:$M$] (B) at (0, 0); \coordinate (C) at (5, 0); \draw[name path=arc] (C) arc[start angle=0, end angle=90, ...


2

Extending the scope may help \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{calc, shadings, shadows, shapes.arrows} \usetikzlibrary{positioning, intersections} \tikzset{mark coordinate/.style={inner sep=0pt, outer sep=0pt, minimum size=3pt, fill=#1, circle} } \begin{document} \begin{tikzpicture}[scale=1, font=\...


2

Please, always provide an MWE, which reproduce your problem Sorry, but your question is not entirely clear. What you like get from your code fragment? Just illustration of an intersection or intersections? Your code fragment is not complete. Paths defined in your code fragment doesn't intersect For illustration you can simplify your code of picture for ...


1

If I understood correctly, a solution with \clip \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{hobby,patterns} \begin{document} \begin{tikzpicture} \path[use Hobby shortcut,closed=true, fill=red,xshift=3cm, yshift=-1cm,fill opacity=0.5] (0.5,0.5) .. (2,4) .. (.5,4) .. (-1,2); \path[use Hobby shortcut,closed=true, fill=blue] (0,...


1

Apparently edges "mincut" and "arc-67" doesn't intersect ("mincut" cross "arc-67" to close of its end or at its end, this is not good visible). You need to move mincut curve a bit more to left. In your MWE many edges are drawn twice, also style definitions are inconsistent. So I took a liberty and recode your MWE (from ...


1

Ok, Seem's I've an answer. \ifthenelse{} into tikzpicture env requires to be outside path instructions. So at compilation time pdftex requires to end the path with a ";", and so the intersections.total attribute reference is closed. But \ifnum{} works perfectly. My solution is: \usepackage{ifthen} \usepackage{tikz} \usetikzlibrary{intersections} \...


Only top voted, non community-wiki answers of a minimum length are eligible