# Not the same scale for the fading and for the actual TikZ picture

In a TikZ picture, I want a white shaded rectangle to overlap perfectly a black rectangle. Here is a MWE of what I have done so far. (In the MWE, the shading is much more simple than the one I want to actually apply.)

\documentclass{article}

\usepackage[letterpaper,textwidth=8.5in,textheight=11in]{geometry}
\usepackage{lscape}

\usepackage{tikz}

\begin{document}
\pagestyle{empty}
\begin{landscape}
\begin{figure}
\centering

right color=transparent!0] (0,0) rectangle ++(0.15,-0.35);

right color=transparent!0] (0.15,0) rectangle ++(0.50,-0.35);

right color=transparent!100] (0.50,0) rectangle ++(1,-0.35);

\begin{tikzpicture}[scale=1]

\coordinate(A) at (1.5,4);
\draw [thick, fill=black] (A) rectangle ++(1,-0.35);
\fill [path fading=fondu, white] (A) rectangle ++(1,-0.35);

\end{tikzpicture}
\end{figure}
\end{landscape}
\end{document}

With this MWE, I obtain this:

It is as though the scale was not the same for the tikzfadingfrompicture than for the actual tikzpicture...

How could I obtain the desired result (a perfect overlap between the white shaded rectangle and the black rectangle underneath)?

This is what I want (but with the type of fading of the image above):

• Don't understand when you say "perfectly". Can you show a picture of what you want? May 24 '15 at 2:54
• The picture is there. I know I could accomplish it with path fading=east, but this is only an example. In reality I will do a more intricate fading shape. May 24 '15 at 3:00
• Well I don't know what you have in mind, so is a little bit that somebody help you ... May 24 '15 at 3:10
• I edited my post to include exactly the fading I want. May 24 '15 at 12:59

From showed your desired picture, I gues that you looking for something like this:

This picture I obtain with:

\documentclass{article}
\usepackage[letterpaper,textwidth=8.5in,textheight=11in]{geometry}
\usepackage{lscape}

\usepackage{tikz}
left color = transparent!0,
right color = transparent!100]

\begin{document}
\pagestyle{empty}
\begin{landscape}
\begin{figure}
\centering

\begin{tikzpicture}
\coordinate(A) at (1.5,4);
\draw [thick,fill=black] (A) rectangle ++(1,-0.35);
\fill [path fading=fondu, white] (A) rectangle ++(1,-0.35);
\end{tikzpicture}
\end{figure}
\end{landscape}
\end{document}

I don't understand, what you like to obtain with:

right color=transparent!100] (0,0) rectangle ++(1,-0.35);

so replace width standard definition of fading in preamble.

Update: I don't know of context of your WME, so I just edit your MWE so that it work in simple cases. For more general solution wee if the following MWE is good starting point for your need:

\documentclass[tikz,border=1mm]{standalone}
fill=black,
]

\begin{document}
\begin{tikzpicture}[
mynode/.style n args = {3}{
name=#1,
fill=#3,
node contents={}% <-- only if you will have always empty rectangle ...
},
myframe/.style 2 args = {
draw=#1,% <-- color of node frame, if it is constant, write color name
% and redefine node style accordingly
ultra thick,
fit=(#2),
inner sep=0pt, outer sep=0pt,
node contents={}},
]
\coordinate(A) at (1.5,4);
\node[mynode={bla}{30}{black},
minimum width=33mm,%select desired size
minimum height=11mm,%select desired size
above right=of A];
\node[myframe={black}{bla}];
\end{tikzpicture}
\end{document}

This time I use standalone package/document class to easier show obtained picture. Instead to draw rectangular I use rectangular shape as node (this is better solution so long your need only nodes defined in shapes library). The first node determine shadings, the second one frame around it.

Shading now can be oriented according to your needs. I hope that above MWE is enough self explanatory.

In case that the aspect ratio between width and height of rectangle is constant, you can determine in mynode/.style nominal size of rectangle and later with scale re-size it to desired size.

Obtained figure:

• This works for my previous example with the simple fading vanishing from left to right, but with the exact fading I want (illustrated above in the edited question), I have more than a left and a right color (in fact the fading picture is the assembly of three rectangles, as can be seen in the code). May 24 '15 at 13:02