title: How to draw 2 rectangles side by side without them overlapping?
body: <p>I'm using following code to draw a series of rectangles:</p>
  
  <pre><code>        for (int j = 0; j &lt; list.Count - 1; j++)//
          {
              var item = list[j];
  
              var nextitem = list[j + 1];
  
              double y;
              y = yScale.Transform(item.Y, ChartScaleType.Logarythmic);
  
              var y1 = yScale.Transform(nextitem.Y, ChartScaleType.Logarythmic);
  
              var perc = item.Color / div;                
  
              var transparency = (float) (perc * contrast);
  
              var c = 255F;
              if (dayColors)
              {
                  c = 0;
              }
  
              var db = Math.Abs(item.Disbalance);
              var ageTransform = 1;
              var split =  Math.Min(1, (float) (db/(db + 1)* ageTransform * polarity));
  
              using (var brush = this.RenderTarget.CreateSolidColorBrush(new D2D.ColorF(c,c, c, transparency*(1-split))))
              {
                  var rectangle = new D2D.RectF((float)Math.Min(x, x1), (float)Math.Max(y, y1), (float)Math.Max(x, x1), (float)Math.Min(y, y1));
                  this.RenderTarget.FillRectangle(rectangle, brush);
              }
  
              var disbalanceColor = increasedDisbalanceColor;
              if (item.Disbalance&lt;0)
              {
                  disbalanceColor = decreasedDisbalanceColor;
              }
  
  
              using (var brush = this.RenderTarget.CreateSolidColorBrush(new D2D.ColorF(disbalanceColor.R/255F, disbalanceColor.G/255F, disbalanceColor.B/255F, transparency * ( split))))
              {
                  var rectangle = new D2D.RectF((float)Math.Min(x, x1), (float)Math.Max(y, y1), (float)Math.Max(x, x1), (float)Math.Min(y, y1));
                  this.RenderTarget.FillRectangle(rectangle, brush);
              }
          }
  </code></pre>
  
  <p>This results in rectangles being separated by grey lines (please ignore the gray points):</p>
  
  <p><a href="https://i.stack.imgur.com/m5qS9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/m5qS9.png" alt="grey lines around rectangles"></a></p>
  
  <p>I want for the image to be as smooth as possible, and for that I don't want the gray lines.</p>
  
  <p>What is a good way to get rid of those?</p>