SLIDES - Saving Graphics

4
Graphics & Image Formats A self-help seminar on dealing with loss, compression, and unplanned pixilation. Vector Seamless grid of square pixels Simple way to define images, but can get very Elements/paths defined by coordinates or formulae Simple graphics are very Raster large files Can be compressed (trade-off with quality) Can be filtered, modified, but difficult. small, but complex graphics can be huge Cannot be compressed Each element may be edited post-creation. Vector Raster Different formats are better for different applications. Raster Vector Original (No Compression) Medium Compression High Compression JPG (3940KB) JPG (1395KB) JPG (460KB) Original (No Compression) Medium Compression High Compression JPG (3940KB) JPG (1395KB) JPG (460KB) Lesson: do what works for your purposes. Science! What we sent… What they published…

Transcript of SLIDES - Saving Graphics

Page 1: SLIDES - Saving Graphics

Graphics & Image Formats

A self-help seminar on dealing

with loss, compression, and with loss, compression, and

unplanned pixilation.

Vector

• Seamless grid of square

pixels

• Simple way to define

images, but can get very

• Elements/paths defined

by coordinates or

formulae

• Simple graphics are very

Raster

images, but can get very

large files

• Can be compressed

(trade-off with quality)

• Can be filtered,

modified, but difficult.

Simple graphics are very

small, but complex

graphics can be huge

• Cannot be compressed

• Each element may be

edited post-creation.

VectorRaster

Different formats are better for different applications.

Raster Vector

Original (No Compression) Medium Compression High Compression

JPG (3940KB) JPG (1395KB) JPG (460KB)

Original (No Compression) Medium Compression High Compression

JPG (3940KB) JPG (1395KB) JPG (460KB)

Lesson: do what works for your purposes.

Science!

What we sent… What they published…

Page 2: SLIDES - Saving Graphics

Lossy vs. lossless formats

• Lossy formats (may) sacrifice quality for file

size (compression).

• Lossless formats retain ALL the information in

the original file (sometimes “raw” or “basic”).the original file (sometimes “raw” or “basic”).

• Lossy formats: JPG,BMP, MP3 (audio), M4A

video)

• Lossless formats: JPG, PNG, TIF, WAV (audio)

• Good articles on Wikipedia

Uncompressed:

R, R, B, B, G, G, G, R

R, N, B, B, G, B, N, R

Compression:

2R, 2B, 3G, G, R

R, N, 2B, G, B, N, R

……

Compression:

R, B, G, R

2B, R, N

(Or it may blend colours)

The trick…

• You can make raster images that are very high quality (lossless or proper compression).

• Use the compression settings that best balance your desired quality with file size.balance your desired quality with file size.

• The rules of thumb:Photos = rastersFigures = vectorsOnly compress when necessaryWhen you compress, do it right!

Saving graphics for

PowerPoint or Adobe Illustrator

1. Save your R graphic in .EMF or .WMF format

2. Open PowerPoint

3. Drop in the graphic file

4. You must ungroup objects to modify them4. You must ungroup objects to modify them

5. Make desired changes

Saving graphics for Adobe Illustrator

1. Save your R graphic as .PDF format

(.EMF & .WMF will also work)

2. Open the file in Adobe Illustrator

3. Select all objects3. Select all objects

4. Release the clipping mask (=ungroup)

5. Make desired changes

6. Save new file as .PDF or .AI file

Why would you bother with this?

• You just can’t get R to do what you want.

(Yes, this actually happens.)

• It’s faster to do it after-the-fact.

(But be careful. If your data changes…)(But be careful. If your data changes…)

• Making publication- or presentation- or

website-specific figures.

• Formatting requirements that R cannot

support (thesis, journal, etc.)

R plot

ArcGIS

Illustratorggplot2

Illustrator

Page 3: SLIDES - Saving Graphics

ggplot2

Illustrator

A word on integrity

Be careful…

Make sure you are changing your graphic only

for clarity or aesthetics.for clarity or aesthetics.

Do not manipulate your data.

This would be serious scientific misconduct.

MRT Example

• We’ll clean this

one up in Adobe

Illustrator

• PDF of the MRT • PDF of the MRT

provided on the

course website

NMDS Example

• Complete the

NMDS plotting

example in the lab

• Files (R code and • Files (R code and

data) are on the

course website

PNG PDF

EPS EMF

-20 -15 -10 -5 0 5 10 15

-10

-50

510

NMDS of Alberta Biomes

X1

X2

A

AP

BSA

CM

CP

DM

DMG

FF

FP

KU

LBH

LF

M

MG

NF

NM

Peac

PRP

SA

UBH

UF

MAT

MWMT

MCMT

TD

MAP

MSP

AHM

Page 4: SLIDES - Saving Graphics

Editing (EPS vs. EMF)

-50

510

NMDS of Alberta Biomes

X2

A

BSA

CM

CP

DM

DMG

FF

FP

LBH

LF

M

MG

NF

NM

PRP

SA

UBH

UF

MAT

MWMT

MCMT

MAP

MSP

AHM

-20 -15 -10 -5 0 5 10 15

-10

X1

APKU

Peac

TD

05

10

NMDS of Alberta Biomes

X2

A

CP

DM

FF

FP

LF

M

MG

NF

PRP

SA

UF

MAT

MCMT

MAP

MSP

AHM

-20 -15 -10 -5 0 5 10 15

-10

-5

X1

X2

AP

BSA

CM

DMG

KU

LBH NF

NM

Peac

UBH

MWMT

TD

0

5

10

NMDS of Alberta Biomes

X2

A CPDM

FF

FP

LBH

LF

M

MG

NF

PRP

SA

UF

MAT

MCMT

MAP

MSP

AHM

Boreal

-20 -15 -10 -5 0 5 10 15

-10

-5

X1

X2

AP

BSA

CM

DMG

KU

LBH

NM

Peac

UBH

MWMT

TD

Boreal

Grassland

Montane

Parkland