dsshow savefig error with matplotlib pdf and svg export. Shading intensity variation in png export.
The datashader plotted points should be the same size as the ax and export well but the scale is off and changes with dpi export settings. Additionally, the shading intensity is variable for png export.
import matplotlib
import matplotlib.pyplot as plt
import datashader as ds
from datashader.mpl_ext import dsshow
import pandas as pd
import numpy as np
# Fake data for testing
x = np.random.normal(size=100000)
y = x * 3 + np.random.normal(size=100000)
fig, ax = plt.subplots()
dsartist = dsshow(
ds.Point("xs", "ys"),
ds.count(),
vmin=0,
vmax=100,
norm="linear",
aspect="auto",
ax=ax
plt.title('300 dpi')
fig.savefig(test_300dpi.pdf, dpi=300)
fig.savefig(test_300dpi.png, dpi=300)
fig.savefig('test_300dpi.svg', dpi=300)
plt.close()
fig, ax = plt.subplots()
dsartist = dsshow(
ds.Point("xs", "ys"),
ds.count(),
vmin=0,
vmax=100,
norm="linear",
aspect="auto",
ax=ax
plt.title('default dpi')
fig.savefig(test_defaultdpi.pdf)
fig.savefig(test_defaultdpi.png)
fig.savefig('test_defaultdpi.svg')
plt.close()
Screenshots or screencasts of the bug in action