I'm having an issue when trying to save a bar plot as an svg. Specifically, when I save the bar plot as a PDF with savefig, I get the correct result. However, when I save it as an SVG, the bars do not terminate at the x-axis as they should but descend past the bottom of the figure. This problem only occurs when I use the log scale for the bar plot. Otherwise, everything is hunky dory.
Here is the code saving the plot as both an SVG and a PDF:
import matplotlib.pyplot as plt
import numpy as np
N = 10
ind = np.arange(N)
series1 = xrange(N)
series2 = [ N - s1_i for s1_i in series1 ]
fig, ax = plt.subplots()
width = 0.2
rects = [ ax.bar(ind, series1, width, color='r', log=True),
ax.bar(ind + width, series2, width, color='b', log=True) ]
plt.savefig("test.pdf")
plt.savefig("test.svg")
Here are the two sample images:
You can see there are no glaring issues with the PDF version.
The SVG version has bars that are not properly clipped, which is wrong.
Update: In response to tcaswell
I'm using Ubuntu 14.04 (kernel version is 3.16.0) with Python 2.7.6, Matplotlib version 1.3.1, numpy version 1.8.2.
I've tried viewing the SVG both with display and rsvg-view-3, and both show the same result; if I convert it to a PDF using ImageMagick's convert command line tool and open it with evince or another viewer such as acroread, the image remains flawed (not particularly surprising).