Use print to save lattice plot in file
Use scales parameter for plots with different axes
png("myfile.png")
# x- and y-axes free
print(densityplot(~my_variable|my_category, main="", scales="free"))
dev.off()
png("myfile.png")
# only y-axes free
print(densityplot(~my_variable|my_category, main="", scales = list(y = list(relation = "free")))
dev.off()