As a follow up to an earlier question, How can I use Contour plots in a skew domain?

I'd like to apply a trapezoidal angle (fe) to my plot, similarly to what's shown in the image on the right. enter image description here

1 Answer 1


I relied on my answer at Gimp-like perspective transform in TikZ to taper an image. Because it only tapers left to right, I had to do a double rotation to taper front to back.

In addition, pgfplots is such a memory hog that I had memory overflow issues, according to this question, How to expand TeX's "main memory size"? (pgfplots memory overload). So rather than deal with externalized plots and such, I took your code at the referenced question (with a 0mm border) to generate the basic un-transformed rectangular image and saved it as myplot.pdf.

Then I relied on my above referenced answer to employ this code which I do not think fixes the perspective problem, originally pointed out by Andrew Kepert in comment to my answer at Gimp-like perspective transform in TikZ. That is to say, while the given straight lines of the OP's problem remain straight under this transformation, one can see that the original diagonals of the figure no longer are straight under this transformation.

  \edef\neck{#3}% percent to depress the amplitude
  \def\cuts{#4}% Number of cuts
  \savebox{\mytext}{#5}% TEXT
      \FPeval{\myprod}{1 - \neck*(\myprod)}%
      \FPeval{\myprod}{1 - \neck*(1-\myprod)}%
      \value{mycount}\clipsize\relax{} %
      -1pt %
      \wd\mytext-\value{mycount}\clipsize-\clipsize\relax{} %

It took the previously generated rectangular image and (after rotation), did 99 vertical slices on it, and scaled and raised as necessary each ribbon slice. Finally it rotated the image back to the original orientation.

enter image description here

The problem is the parameters to \tapertext do not necessarily correspond to desired angles, etc. The first mandatory parameter effects the left/right skew (a value of 1.0 makes the left edge vertical) while the second mandatory argument (#3) is related to the net shrinkage of the tail of the image relative to the front (namely, the back edge length is (1 - #3^2) times the front -edge length and a value of 1.0 tapers the image to the vanishing point). Using \rotatebox{90}{\tapertext{.10}{.50}{99}{\rotatebox[origin=left]{-90}{\includegraphics{myplot}}}} produces, for example, this:

enter image description here

You must log in to answer this question.

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