This is a follow-up to question Pgfplots rounded corners and plot problem.

When the grid is right on the edge of the plot, it does not bend with the axes. Is it possible to apply bending to the grid too ?

enter image description here

The code:



\begin{tikzpicture}[scale=0.8,trim axis left, trim axis right]
\tikzset{every mark/.append style={scale=0.6}}
\pgfplotsset{legend style={font=\footnotesize}}

\begin{axis}[   grid=both,xmin=-10,xmax=10,ymin=-1,ymax=1,
        axis line style={rounded corners},
\addplot[samples=100,color=blue,very thick,smooth,domain=-10:10] {cos(x^(3))};



  • Can you please post the code that you use to generate the image? Thanks.
    – darthbith
    Mar 22, 2015 at 13:38
  • I edited the question. Thanks for your interest Mar 22, 2015 at 13:43
  • Ideas anyone ??? Apr 7, 2015 at 9:38

1 Answer 1


How do you think the ticks should be "bended"? I think you mean with this that they should move to the "inner part" of the axis, but this is not (easily) possible I think.

Here I present two solutions without "bending" the ticks. For more details have a look at the comments in the code.

% used PGFPlots v1.14
            % define some macros that hold the min and max values for the axes ...
            % and apply the values here
            axis line style={rounded corners},    % = rounded corners=4pt
            % -----
            % activate the `set layers' feature to be sure that the extra
            % ticks are drawn below the axis lines
            set layers,
            % then add extra ticks in the four corners
            % (unfortunately `\pgfkeysvalueof{/pgfplots/xmin}' and friends
            %  can't be used in the axis options, so you have to provide the
            %  values manually or you have do define commands like I did,
            %  so you only have one place if you want to change the values)
            extra x ticks={\xmin,\xmax},
            extra y ticks={\ymin,\ymax},
            % and finally set the extra tick style to draw thick white lines
            % ("thick" because the grid lines are drawn thick by default)
            % (of course this means that you will see the white lines,
            %  if you change the background color!)
            extra tick style={
                tick style={
            % -----
%            % alternatively just enlarge the limits a bit, so the ticks
%            % are outside of the "rounded corners part"
%            % (the default value of `rounded corners' is 4pt)
%            enlargelimits={abs=4pt},
            % -----
            \addplot [
                very thick,
            ] {cos(x^(3))};

image showing a zoomed result of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .