Is there a way to specify where a line intersects a 'mark' on a pgfplot?


\begin{axis}[ enlarge x limits=0.25, enlarge y limits=0.25 ] 
\addplot[mark=-, mark size={15pt}] table  {
1.00  1.0
5.00  2.0 }; 
\end{tikzpicture} \end{figure} 

This produces

Line intersecting the center of the mark

What I'd Like

Line intersecting right and left of mark

So, in summary, is there a way to explicitly specify where a line which connects two marks on a pgfplot intersects with the mark other than at the 'center'? I'm more interested in right/left hand side intersections but any additional insight into top/bottom intersections as well as 'anywhere in between' is welcomed.

Real world application (by request):

Many examples of reaction pathway or reaction coordinate plots exist in the sciences. These usually involve plotting points on an energy graph (y-axis) vs. some pre-defined reaction coordinate (x-axis). Sometimes it is beneficial to use line marks (rather than circles or squares etc.) because text can be readily added above and/or below the lines to denote certain things like the name of the structure at that point on the graph. Lines are used to indicate the connectivity of various points on the graph in a physical sense. That is, two structures (i.e. points) are indeed connected on a potential energy surface as determined via some intrinsic reaction coordinate analysis.

The problem with my current working example lies with the fact that the line intersects with the 'line marks' at the center. This causes problems when inserting text above and/or below these lines. By offsetting this 'intersection' (as seen in the second figure), the problem ceases to exist while retaining the benefit of illustrating 'connectivity' between two points.

  • Could you provide some detail about what the "real world" application" of this is? (It makes it more satisfying to work on a solution)
    – Jake
    Jun 4, 2014 at 19:27
  • @Jake I hope my edit satisfactorily addresses your concern. Jun 4, 2014 at 19:41
  • Possible, yes. Easy, no. For example, you could use a separate \addplot for each mark. Jun 5, 2014 at 12:55
  • @JohnKormylo I can just draw lines and manually set coordinates that positing them properly. I figured that a more appropriate solution would be readily available. I suppose I can delete this post and use the less-preferred workaround. Jun 5, 2014 at 14:25

2 Answers 2


I wouldn't use pgfplots for this. I think the endiagram package by Cle­mens Nieder­berger has already all features included that you need. Here I just show two examples copied from the manual, but of course you can combine the features as you like ...

\sisetup{per-mode = fraction}
    % ---------------------------------------------------------------------
    % copied from the `endiagram' manual section 9 (page 24f in v0.1d)
    % (needs the package `chemmacros')
        \node[above,xshift=4pt] at (N1-2) {[\"UZ1]$^{\transitionstatesymbol}$} ;
        \node[below] at (N1-3) {ZZ} ;
        \node[above,xshift=4pt] at (N1-4) {[\"UZ2]$^{\transitionstatesymbol}$} ;
        \draw[<-,red] (N1-2) -- ++(2,1) node[right] {transition state} ;
    % ---------------------------------------------------------------------
    % copied from the endiagram manual section 11.2 (page 32f in v0.1d)
    % (needs the package `chemmacros')
        energy-step           = 100,
        energy-unit           = \kilo\calory\per\mole,
        energy-unit-separator = { in },
        y-label               = above,
        AddAxisLabel/font     = \footnotesize,
    % ---------------------------------------------------------------------

image showing the result of above code


Setphan's answer above helped me immensely when building the potential energy diagram for the Chemistry class. I used additional options to comply with the format required in the course, so here is the result:


    y-label-text={\footnotesize Potential energy}
    ,x-label-text={\footnotesize Reaction progress}
\ShowEa[label,connect={draw=none},from={(N1-1) to (N1-2)}]
\ShowEa[label,connect={draw=none},from={(N1-3) to (N1-4)}]
\ShowEa[label,connect={draw=none},from={(N1-5) to (N1-6)}]
\ShowEa[label,connect={draw=none},from={(N1-7) to (N1-8)}]
\node[above,xshift=4pt] at (N1-2) {AC} ;
\node[below] at (N1-3) {RI} ;
\node[above,xshift=4pt] at (N1-4) {AC} ;
\node[below] at (N1-5) {RI} ;
\node[above,xshift=4pt] at (N1-6) {AC} ;
\node[below] at (N1-7) {RI} ;
\node[above,xshift=4pt] at (N1-8) {AC} ;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.