2.5.7. Drawing vector graphics with Adobe Illustrator and Inkscape

Broadly, there are two types of graphics: vector graphics and raster graphics. Vector graphics are combinations of elemental graphical objects such as lines, curves, arcs, ellipses, text, strokes, fills, and gradients. Consequently, vector graphics are vector graphics are infinitely scalable (i.e. they never become pixelated when they are enlarged) and well-suited for scientific diagrams. Two of the most common vector graphic editing programs are Illustrator and Inkscape. Some of the most common file formats used to store vector graphics include .ai, .eps, .pdf, and .svg.

Raster graphics are matrices of colored pixels. Raster graphics are commonly used to describe photographs as well as to display graphics originally created as vector graphics in websites and other documents. Some of the most common raster graphic editing programs are Photoshop and Gimp. Photoshop is a commercial program developed by Adobe and Gimp is a free, open-source program. Photoshop is the standard among graphics professionals, but Gimp is easier to learn and sufficient for our needs as scientists. Some of the most common file formats used to store raster graphics are .gif, .jpg, and .png format.

In this tutorial, we will teach you how to draw vector graphics with Illustrator and Inkscape by drawing a picture of a cell. Key concepts

  • Raster graphics vs. Vector graphics

  • Fundamental vector graphic objects

  • Color models

  • Selecting and editing graphical objects

  • Grouping objects

  • Masking objects

  • Exporting diagrams Fundamental vector graphic objects

As introduced above, vector graphics are composed of the following elemental graphical objects:

  • Paths

    • Bezier curves

    • Lines

  • Shapes

    • Circles

    • Ellipses

    • Polygons

    • Rectangles

  • Text

  • Fills and strokes

    • Solid

    • Gradient

  • Groups

  • Masks

  • Layers Color models

Vector graphics can be described using one of several common color models:

  • CMYK (Cyan, Magenta, Yellow, Black): CMYK is a subtractive color model which represents colors as tuple of cyan, magenta, yellow, and black values, each of which ranges from 0 to 100%. CMYK is the native color model for many printers. For this reason, some journals prefer CMYK.

  • RGB (Red, Green, Blue): RGB is an additive color model which represents colors as tuples of red, green, and blue values, each of which ranges from 0 to 255. RGB is the native color model for many monitors. For this reason, RGB is most common color model for web-based graphics and some journals prefer RGB.

  • HSB (Hue, Saturation, Brightness) / HSV (Hue, Saturation, Value): HSB is a cylindrical color model which makes it easy to manipulate saturation and brightness separately from color. For this reason, HSB is useful to designing color palettes.

  • Grayscale: is an additive color model which represents colors as integers between 0 and 255.

Illustrator supports all four of these color models, and documents created in any one of these color models can be exported to any of the other color models. Inkscape only supports the RGB color model.

We recommend using RGB except for submissions to journals which require CMYK figures. Vector graphics drawing tools: Illustrator vs Inkscape

Illustrator and Inkscape are two of the most popular vector graphics editing programs. Illustrator is a commercial program developed by Adobe and Inkscape is a free, open-source program. Illustrator is the industry standard and is more powerful than Inkscape.

Illustrator and Inkscape share many of the same core functionality. However, Inkscape lacks many of the more advanced features of Illustrator. In addition, Illustrator is substantially faster than Inkscape, especially for large graphics. This is critical for editing complex plots generated by graphing utilities such as matplotlib. Furthermore, there are substantially more tutorials and examples for Illustrator than for Inkscape. However, some people find Inkscape easier to learn. Below is a list of some of the limitations of Inkscape compared to Illustrator.

  • Significantly slower for complex graphics

  • Interface is less polished

  • Poor default options for subscripts, superscripts

  • No linked text boxes for continued text flow

  • No tool to edit spacing of dashes

  • No CMYK support

  • No native support for a binary file format such as .ai

  • Less control over .png export

  • No .gif, .jpg export Vector graphics file formats

Some of the most common file formats used to represent vector graphics include AI, EPS, PDF, and SVG. AI is a proprietary and efficient binary format that is used by Illustrator. SVG (Scalable Vector Graphics) is an XML-based open standard for describing vector graphics and the native format for Inkscape. Because SVG is an XML format, SVG is easy to generate programmatically. However, because SVG is an XML format, SVG is also inefficient and poorly suited to large graphics such as complex plots created by matplotlib. EPS and PDF are binary vectors graphics formats that are supported by both Illustrator and Inkscape. Consequently, these formats should be used to provide graphics to journals. Required software

This tutorial requires Illustrator and Inkscape.

On Ubuntu, you can use this command to install Inkscape:

sudo apt-get install inkscape Illustrator exercise

In this exercise we will learn how to use Illustrate by drawing a digram of a cell

  1. Open Illustrator

  2. Set the canvas units size

  3. Use the ellipsis tool to draw a cell

  4. Set the stroke and fill color

  5. Add a drop shadow

  6. Add a straight line into the cell

  7. Add an arrow head to the line

  8. Turn the line into a curve

  9. Copy the line to create a line out of the cell

  10. Add a textual label on top of the cell

  11. Create a mask to highlight the area that you want to highlight

    1. Draw a rectangle over the area you want to highlight

    2. Select the rectangle and all of the graphical element below it

    3. Create the mask

  12. Save the diagram in AI format

  13. Save the diagram to PDF format to use in manuscripts

  14. Export the diagram to PNG format to use in PowerPoint and websites Other useful features

  • Selecting similar objects

  • Joining lines

  • Placing other documents Inkscape exercise

In this exercise we will learn how to use Inkscape by drawing a digram of a cell

  1. Open Inkscape

  2. Set the size of the canvas

    1. Open “File” >> “Document Properties…”

    2. Set “Units” to “in”

    3. Set “Width” to “7.5”

    4. Set “Height” to “5”

    5. Close the window

    6. Type “5” to fit the canvas to your screen

  3. Draw the cell membrane

    1. Select the ellipse tool

    2. Drag an ellipse over the canvas

    3. Right click on the ellipse and select “Fill and Stroke…” to edit the line and fill colors and line style of the membrane.

      1. Increase the stroke width of the membrane

      2. Change the stroke style of the membrane to dashed

      3. Apply a radial gradient fill to the body of the membrane

      4. Adjust the center and shape of the radial gradient

    4. Add a drop shadow to the cell by selecting “Filters” >> “Shadows and Glows” >> “Drop Shadow…”

  4. Draw an arrow into the cell

    1. Select the Bezier curves tool

    2. Select one or more points on the canvas. Optionally, hold down the control key to draw a straight line.

    3. Double click to finish the curve

    4. Optionally, use the “Align and Distribute” tool to straighten the line

    5. Use the edit path tools to fine tune the curve

    6. Right click on the line and select “Fill and Stroke…” >> “Stroke style” to apply arrow markers to the line

  5. Create an arrow which points out of the cell by copying the first arrow

    1. Left click on the first arrow and hold down

    2. While still holding down the left mouse button, click the space bar

    3. Begin dragging your mouse

    4. Press down the control key to constraint the dragging so that the second arrow is vertically aligned with the first

  6. Vertically align the cell and lines

    1. Open the “Align and distribute objects” window

    2. Select both the cell and line

    3. Click the “Center on horizontal axis” button to align the objects

  7. Add a label to the cell

    1. Select the text tool

    2. Click on the canvas where you want the text to appear

    3. Type “Cell”

    4. Right click on the label and select “Text and Font…” to adjust the font type, font size, text color, and text alignment

    5. Use the dropper tool to copy the cell stroke color to the text

    6. Bring the text in front of the cell by selecting “Object” >> “Raise to Top”

  8. Group the cell and label

    1. Select the cell and label

    2. Select “Object” >> “Group”

    3. Now you can move the objects together

    4. Double click on the combine object to access the individual cell and label objects

  9. Highlight a specific part of the cell

    1. Draw a rectangle over the portion of the cell that you would like to highlight

    2. Select both this new rectangle and the cell

    3. Right click on the objects and select “Set Mask”

  10. Save the diagram

    1. Select “File” >> “Save”

    2. For simple graphics, choose the “Inkscape SVG (.svg)” format. For complex graphics, choose the “Compressed Inkscape SVG (.svgz)” format.

  11. Export the diagram

    1. Select “File” >> “Export PNG Image…”

    2. Set the desired export size and resolution Other useful features Selecting other objects with the same fill and/or stroke

  • Select an object

  • Right click on the object and select “Select Same” >> “Fill and Stroke” Joining lines

  • Use the “Edit paths by node” to select a node in a curve

  • Hold to the shift key and select another node in another curve

  • Click the “Join selected nodes” button to join the curves Embedding graphics

  • Select “File” >> “Import”

  • Select the file that you wish to import

  • Select whether to “Embed” or “Link” the imported file Additional tutorials Illustrator

Kevin Bonham has several helpful tutorials videos designed for scientists. Skill Developer also has a large number of brief tutorial videos. Inkscape

Derek Banas has several helpful short tutorial videos. The Inkscape Tutorials Blog has numerous examples of how to draw a variety of graphics.