The source of the difficulty is that ellipses are constructed in a particular way in TikZ. They are paths that start from the x-axis and proceed counter-clockwise around their centre. The vast majority of the time, the exact parametrisation doesn't matter. You appear to have found the one situation where it does!
In the actual question, you only want to be able to mirror the ellipse, and so draw it starting from the negative x-axis (the title of the question suggests a more flexible approach). That's actually not too hard since we can exploit the symmetry of the ellipse. The key is to provide it with a negative x-radius, since then it will start from the negative x-axis (and proceed clockwise, but we could correct for that by negating the y-radius as well). To do this, we interrupt the call from the node shape to the drawing command and flip the sign of the x-radius. The simplest way to do this is to redefine the \pgfpathellipse
macro to do the negation and then call the original macro. The following code does this.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations,shapes,decorations.markings}
\makeatletter
\let\origpgfpathellipse=\pgfpathellipse
\def\revpgfpathellipse#1#2#3{%
#2%
\pgf@xa=-\pgf@x
\origpgfpathellipse{#1}{\pgfqpoint{\pgf@xa}{0pt}}{#3}}
\makeatother
\tikzset{
reversed ellipse/.style={
ellipse,
reverse the ellipse%
},
reverse the ellipse/.code={
\let\pgfpathellipse=\revpgfpathellipse
}
}
\begin{document}
\begin{tikzpicture}
\node[ellipse,
draw,
postaction={
decorate,
decoration={
markings,
mark=at position 1 with {
\arrow[line width=5pt,blue]{>}
}
}
}
] at (0,0) {hello world};
\node[reversed ellipse,
draw,
postaction={
decorate,
decoration={
markings,
mark=at position 1 with {
\arrow[line width=5pt,blue]{>}
}
}
}
] at (0,-2) {hello world};
\end{tikzpicture}
\end{document}
Here's the result:
(the arrow got clipped, but you can see where it lies)
You can use the style more than once:
\node [draw, double circle={2pt}{black!75},
double circle={4pt}{black!50},
double circle={6pt}{black!25}] (c1) {};
Or could nest them:
\node [draw,
double circle={2pt}{black!75,
double circle={2pt}{black!50,
double circle={2pt}{black!25}}}] (c1) {};
Code
\documentclass[tikz] {standalone}
\usetikzlibrary{calc}
\tikzset{
old inner xsep/.estore in=\oldinnerxsep,
old inner ysep/.estore in=\oldinnerysep,
double circle/.style 2 args={
circle,
old inner xsep=\pgfkeysvalueof{/pgf/inner xsep},
old inner ysep=\pgfkeysvalueof{/pgf/inner ysep},
/pgf/inner xsep=\oldinnerxsep+#1,
/pgf/inner ysep=\oldinnerysep+#1,
alias=sourcenode,
append after command={
let \p1 = (sourcenode.center),
\p2 = (sourcenode.east),
\n1 = {\x2-\x1-#1-0.5*\pgflinewidth}
in
node [inner sep=0pt, draw, circle, minimum width=2*\n1,at=(\p1),#2] {}
}
},
double circle/.default={2pt}{blue}
}
\begin{document}
\begin{tikzpicture}
\node [draw, double circle={2pt}{black!75},
double circle={4pt}{black!50},
double circle={6pt}{black!25}] (c1) {};
\node [draw, double circle={-2pt}{black!75},
double circle={-4pt}{black!50},
double circle={-6pt}{black!25}] (c2) at (2,0) {};
\end{tikzpicture}
\begin{tikzpicture}
\node [draw,
double circle={2pt}{black!75,
double circle={2pt}{black!50,
double circle={2pt}{black!25}}}] (c1) {};
\node [draw,
double circle={-2pt}{black!75,
double circle={-2pt}{black!50,
double circle={-2pt}{black!25}}}] (c2) at (2,0) {};
\end{tikzpicture}
Output
Best Answer
There are so called partial arrow tips in TikZ. Use for instance
left to
,right to
,left hook
orright hook
. They are desribed in section 23.7 of the pfg 2.10 manual (22.6 in the pgf 2.0 manual).Inserting this into your example: