Jesvin Jose
Jesvin Jose

Reputation: 23098

How to do a plot in 1000 pixels?

I want to plot 1600 points to a graph (only graph, not counting axes and whitespaces) 1000 pixels wide. Is this method of setting the inches and pixels per inch (DPI) the best way? Is there a better way?

self.figure, (self.picture, self.intensity) = \
        plt.subplots(nrows=2, figsize=(10, 5))
    self.figure.set_dpi(100)

Upvotes: 2

Views: 319

Answers (1)

pelson
pelson

Reputation: 21849

For a figure of 1600 pixels wide and 1000 pixels high you could do something like:

import matplotlib.pyplot as plt
plt.figure(figsize=(16, 10), dpi=100)
# ... your code
plt.savefig(filename)

Upvotes: 2

Related Questions