<p dir="auto">I think line 567 in tools/rplot.py "ax.contour(Z, extent=[x_min, x_max, y_min, y_max])" should be changed to "ax.contour(Z.T, extent=[x_min, x_max, y_min, y_max])"</p>
<p dir="auto">When I plot a density map, the graph is rotated by 90 degrees.</p>
<p dir="auto">The axes drawn by rplot.GeomDensity2D are flipped.<br>
line 565 reads:<br>
<code class="notranslate">ax.contour(Z, extent=[x_min, x_max, y_min, y_max])</code><br>
but should read:<br>
<code class="notranslate">ax.contour(Z.T, extent=[x_min, x_max, y_min, y_max])</code><br>
The following test code gives the results shown below:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pandas.tools.rplot as rplot

x = np.arange(1,30)
y = x*x
x = x + np.random.normal(size=x.shape)
y = y + np.random.normal(size=y.shape)
data = data = pd.DataFrame({'x': x, 'y': y})
plot = rplot.RPlot(data, x='x', y='y')
plot.add(rplot.GeomScatter())
plot.add(rplot.GeomDensity2D())
plot.add(rplot.GeomPolyFit(degree=2))
plot.render(plt.gcf())
plt.show()"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>
<span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
<span class="pl-k">import</span> <span class="pl-s1">pandas</span>.<span class="pl-s1">tools</span>.<span class="pl-s1">rplot</span> <span class="pl-k">as</span> <span class="pl-s1">rplot</span>

<span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">1</span>,<span class="pl-c1">30</span>)
<span class="pl-s1">y</span> <span class="pl-c1">=</span> <span class="pl-s1">x</span><span class="pl-c1">*</span><span class="pl-s1">x</span>
<span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">x</span> <span class="pl-c1">+</span> <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">normal</span>(<span class="pl-s1">size</span><span class="pl-c1">=</span><span class="pl-s1">x</span>.<span class="pl-s1">shape</span>)
<span class="pl-s1">y</span> <span class="pl-c1">=</span> <span class="pl-s1">y</span> <span class="pl-c1">+</span> <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">normal</span>(<span class="pl-s1">size</span><span class="pl-c1">=</span><span class="pl-s1">y</span>.<span class="pl-s1">shape</span>)
<span class="pl-s1">data</span> <span class="pl-c1">=</span> <span class="pl-s1">data</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>({<span class="pl-s">'x'</span>: <span class="pl-s1">x</span>, <span class="pl-s">'y'</span>: <span class="pl-s1">y</span>})
<span class="pl-s1">plot</span> <span class="pl-c1">=</span> <span class="pl-s1">rplot</span>.<span class="pl-v">RPlot</span>(<span class="pl-s1">data</span>, <span class="pl-s1">x</span><span class="pl-c1">=</span><span class="pl-s">'x'</span>, <span class="pl-s1">y</span><span class="pl-c1">=</span><span class="pl-s">'y'</span>)
<span class="pl-s1">plot</span>.<span class="pl-en">add</span>(<span class="pl-s1">rplot</span>.<span class="pl-v">GeomScatter</span>())
<span class="pl-s1">plot</span>.<span class="pl-en">add</span>(<span class="pl-s1">rplot</span>.<span class="pl-v">GeomDensity2D</span>())
<span class="pl-s1">plot</span>.<span class="pl-en">add</span>(<span class="pl-s1">rplot</span>.<span class="pl-v">GeomPolyFit</span>(<span class="pl-s1">degree</span><span class="pl-c1">=</span><span class="pl-c1">2</span>))
<span class="pl-s1">plot</span>.<span class="pl-en">render</span>(<span class="pl-s1">plt</span>.<span class="pl-en">gcf</span>())
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/bb85c83926a7847811e636d20448088edfc9c0d8d080680b48045d6e5c8d230b/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f343631323237372f3630363334382f63653665356237342d636432382d313165322d396332642d3537356565663461383138362e706e67"><img src="https://camo.githubusercontent.com/bb85c83926a7847811e636d20448088edfc9c0d8d080680b48045d6e5c8d230b/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f343631323237372f3630363334382f63653665356237342d636432382d313165322d396332642d3537356565663461383138362e706e67" alt="density_as_is" data-canonical-src="https://f.cloud.github.com/assets/4612277/606348/ce6e5b74-cd28-11e2-9c2d-575eef4a8186.png" style="max-width: 100%;"></a></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/e703f93b965bf7c486f4607e6b6be195fb9d1d234b7f896c36fd4dd6c46cbe96/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f343631323237372f3630363334392f63653730366265342d636432382d313165322d386163392d6561356137333063303333632e706e67"><img src="https://camo.githubusercontent.com/e703f93b965bf7c486f4607e6b6be195fb9d1d234b7f896c36fd4dd6c46cbe96/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f343631323237372f3630363334392f63653730366265342d636432382d313165322d386163392d6561356137333063303333632e706e67" alt="density_fixed" data-canonical-src="https://f.cloud.github.com/assets/4612277/606349/ce706be4-cd28-11e2-8ac9-ea5a730c033c.png" style="max-width: 100%;"></a></p>