I am trying to plot a surface using matplotlib. There is problem that, even if I specify the linewidth as zero in the code, the show() displays the correct plot without lines. However the pdf generated still has lines in it.
Can anyone tell how to resolve this problem?
Here is the code that I am using to plot
#!/usr/bin/env python
import numpy as np
from matplotlib import cm
import matplotlib.pyplot as plt
import scipy.ndimage as ndimage
vmaxValue=400
#plt.ion()
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
fileName="test"
csvFile=fileName+".csv"
outputFile=fileName+".pdf"
pgfFile=fileName+".pgf"
data = np.genfromtxt(csvFile)
# Delete the first row and first column.
Z = np.delete(data, (0), axis=0)
Z = np.delete(Z, (0), axis=1)
Z2 = ndimage.gaussian_filter(Z, sigma=0.85, order=0)
X, Y = np.meshgrid(np.arange(1,len(Z[0])+1,1), np.arange(1,len(Z)+1,1))
surf = ax.plot_surface(X, Y, Z2, linewidth=0, cstride=1, rstride=1, cmap=cm.coolwarm, antialiased=False, vmin=0, vmax=vmaxValue)
#plt.colorbar()
fig.colorbar(surf, ax=ax, shrink=0.75,pad=-0.05, aspect=15)
ax.set_zlim(0,vmaxValue)
ax.set_xlabel(r'$\alpha$')
ax.set_ylabel('processors')
ax.set_zlabel('Exploration Time(seconds)')
ax.view_init(20, -160)
fig.savefig(outputFile,format="pdf", bbox_inches='tight')
here is the csv file test.csv
Processors graph1 graph2 graph3 graph4 graph5 graph6 graph7 graph8 graph9 graph10 graph11 graph12 graph13 graph14 graph15 graph16 graph17 graph18 graph19 graph20 graph21 graph22 graph23
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 10 7 190 180 360 180 360 180 360 180 360 180 360 180 360
3 0 0 0 0 0 0 0 0 0 64 52 85 247 274 180 360 360 360 360 360 360 360 360
4 0 0 0 0 0 0 0 0 6 1 1 2 180 180 187 187 180 180 360 360 180 180 360
5 0 0 0 0 0 0 0 0 0 0 180 177 175 180 180 360 360 360 360 360 540 540 360
6 0 0 0 0 0 0 0 1 1 1 1 1 181 181 180 180 180 180 360 360 360 360 180
7 0 0 0 0 0 0 0 8 12 6 6 7 8 8 180 180 180 180 180 180 180 360 180
8 0 0 0 0 0 0 0 0 180 133 175 166 148 180 180 180 180 180 180 180 180 180 360
9 0 0 0 0 0 0 0 0 0 180 180 180 180 180 180 180 180 180 180 180 180 180 360
10 0 0 0 0 0 0 0 0 0 0 180 180 180 180 180 180 180 180 180 180 180 180 360
11 0 0 0 0 0 0 0 0 0 0 0 180 180 180 180 180 180 180 180 180 180 180 360
12 0 0 0 0 0 0 0 0 0 0 0 0 180 180 180 180 180 180 180 180 180 180 180
13 0 0 0 0 0 0 0 0 0 0 0 0 0 180 180 180 180 180 180 180 180 180 180
14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 180 180 180 180 180 180 180 180 180
15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 180 180 180 180 180 180 180 180
16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 180 180 180 180 180 180 180
17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 180 180 180 180 180 180
18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 180 180 180 180 180
19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 180 180 180 180
20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 180 184 180
21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 180 180
22 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 180
23 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
24 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
25 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Thanks