Send
Close Add comments:
(status displays here)
Got it! This site "robinsnyder.com" uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website. Note: This appears on each machine/browser from which this site is accessed.
Matplotlib: subplots and image formats
1. Matplotlib: subplots and image formats
Matplotlib provides for more than one subplot in a plot image.
The default is a 1 by 1 grid of plots. Below is a program that provides for a 2 by 2 grid of plots.
Note that, by default, the plot goes from 0.0 to 1.0 on both axes.
2. Image types
Matplotlib supports many image types such as the following.
eps
jpeg/jpg
pdf
pgf
png
ps
raw
rgba
svg
svgz
tif
tiff
Note that the
gif type (due to copyright issues) is not included. To obtain a
gif one needs to generate, say, a
png (256 colors) and then use another program, such as ImageMagick, to convert that image to a
gif.
The same holds for the
bmp image type, which is not used, except in Windows, due to lack of general compression capability.
3. Program with 2 by 2 grid of plots
Here is the Python code [#1]
Here is the output of the Python code.
4. PNG image
Here is the image for the 2 by 2 grid of (empty) plots in
png format.
5. JPEG image
Here is the image for the 2 by 2 grid of (empty) plots in
jpg format.
Note: There are various compression settings for
jpg. The default was used here.