New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Start learning with our library of video tutorials taught by experts. Get started

Interactive Data Visualization with Processing
Illustration by

Transforming the grid


From:

Interactive Data Visualization with Processing

with Barton Poulson

Video: Transforming the grid

In this movie, I want to show you some of the methods that Processing gives you for manipulating the grid on which you make your sketches, that is the invisible grid that exists inside the window of pixels across and pixels up and down. Let's start this by putting a little comment here at the top of the drawing, at the top of the sketch and I'm going to bring in a color palette as an array, this one is called chemistry and what I have is OC2550, I am to remove the space and turn on the capitals to do this.
Expand all | Collapse all
  1. 3m 16s
    1. Welcome
      58s
    2. What you should know
      1m 22s
    3. Using the exercise files
      56s
  2. 11m 51s
    1. Overview of data visualization
      11m 51s
  3. 11m 53s
    1. Installing Processing
      3m 38s
    2. Overview of Processing
      4m 5s
    3. Exploring libraries
      4m 10s
  4. 1h 1m
    1. Basic setup
      7m 31s
    2. Drawing points
      4m 37s
    3. Drawing lines
      5m 6s
    4. Drawing ellipses and circles
      5m 24s
    5. Drawing arcs
      6m 54s
    6. Drawing rectangles and squares
      4m 58s
    7. Drawing quadrangles
      3m 25s
    8. Drawing triangles
      2m 55s
    9. Drawing polygons
      3m 37s
    10. Drawing simple curves
      4m 54s
    11. Drawing complex curves
      6m 46s
    12. Drawing Bézier curves
      5m 38s
  5. 54m 3s
    1. Introduction to variables
      10m 44s
    2. Understanding variable scope
      6m 53s
    3. Modifying variables
      9m 8s
    4. Creating arrays
      9m 53s
    5. Modifying arrays
      6m 37s
    6. Creating strings
      7m 3s
    7. Modifying strings
      3m 45s
  6. 1h 2m
    1. Incorporating randomness
      7m 59s
    2. Using Perlin noise
      4m 24s
    3. Shuffling with Java
      3m 30s
    4. Specifying line attributes
      8m 2s
    5. Changing placement modes
      5m 45s
    6. Understanding color attributes and functions
      4m 16s
    7. Exploring color spaces
      7m 44s
    8. Using color palettes
      7m 5s
    9. Transforming the grid
      8m 38s
    10. Exploring the attribute matrix
      5m 33s
  7. 52m 7s
    1. Building code blocks
      5m 57s
    2. Writing a while loop
      3m 52s
    3. Using for loops
      5m 35s
    4. Creating conditionals
      14m 50s
    5. Working with easing
      10m 51s
    6. Creating spirals
      11m 2s
  8. 18m 55s
    1. Mouse tracking
      3m 54s
    2. Hovering and clicking
      11m 16s
    3. Understanding keyboard interaction
      3m 45s
  9. 27m 32s
    1. Specifying fonts
      6m 43s
    2. Using images
      5m 51s
    3. Playing a video loop
      6m 20s
    4. Exporting video
      3m 47s
    5. Adding sound
      4m 51s
  10. 20m 49s
    1. Creating functions
      11m 48s
    2. Creating classes and objects
      9m 1s
  11. 31m 10s
    1. Using embedded data
      5m 26s
    2. Working with appended text data
      6m 4s
    3. Working with appended tabular data
      10m 26s
    4. Reading XML data
      9m 14s
  12. 48m 17s
    1. Generating dot plots
      11m 11s
    2. Building scatter plots
      10m 0s
    3. Making line plots
      9m 55s
    4. Creating bar charts
      9m 12s
    5. Checking out examples of maps, hierarchies, and networks
      7m 59s
  13. 20m 57s
    1. Introducing some principles of 2D design
      13m 44s
    2. Understanding color theory
      7m 13s
  14. 24m 46s
    1. Interacting with zooming, rotating, and sliding
      6m 26s
    2. Implementing slicing
      6m 47s
    3. Using rollovers
      5m 58s
    4. Introducing the GUI libraries
      5m 35s
  15. 10m 35s
    1. Sharing via OpenProcessing and other sites
      3m 19s
    2. Saving as a desktop application
      2m 42s
    3. Saving as JavaScript
      1m 47s
    4. Saving as an Android application
      2m 47s
  16. 2m 38s
    1. Where to go from here
      2m 38s

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
please wait ...
Interactive Data Visualization with Processing
7h 43m Beginner Sep 25, 2012

Viewers: in countries Watching now:

Start communicating ideas and diagramming data in a more interactive way. In this course, author Barton Poulson shows how to read, map, and illustrate data with Processing, an open-source drawing and development environment. On top of a solid introduction to Processing itself, this course investigates methods for obtaining and preparing data, designing for data visualization, and building an interactive experience out of a design. When your visualization is complete, explore the options for sharing your work, whether uploading it to specialized websites, embedding the visualizations in your own web pages, or even creating a desktop or Android app for your work.

Topics include:
  • Exploring the need for creative data visualization
  • Drawing basic lines and shapes
  • Introducing variables, strings, and arrays
  • Modifying drawing attributes such as color
  • Making drawings more dynamic with animation loops and spirals
  • Creating keyboard- and mouse-based interactions
  • Adding images, video, and sound
  • Reading in text or XML data
  • Creating plots and charts
  • Publishing and sharing your work
Subjects:
Developer Programming Languages
Software:
Processing
Author:
Barton Poulson

Transforming the grid

In this movie, I want to show you some of the methods that Processing gives you for manipulating the grid on which you make your sketches, that is the invisible grid that exists inside the window of pixels across and pixels up and down. Let's start this by putting a little comment here at the top of the drawing, at the top of the sketch and I'm going to bring in a color palette as an array, this one is called chemistry and what I have is OC2550, I am to remove the space and turn on the capitals to do this.

Next one is A3DOC1, next one is FDF6DD, after that is FEE406 and the last one is a F4651. I close with a curly bracket, and that's the palette that I'm going to be using can be using for this particular design, and then I'm going to introduce a secondary palette, just to keep the name. Great.

Now what I'm going to do, is I'm going to create a size window. I'm going to do 600x200, I'm going to turn on smooth, I'm going to turn off the strokes and I'm going to make the background, the first color in the palette. We can just check that up by seeing, yep, there we have a dark blue. All right, now there's two other variables that I want to introduce into this one, that are going to be helpful in creating the shapes I use for this one.

I'm going to have one that is the size of some of the shapes, "s" is for size, I'll make that 80; then I have another one "d" that'll also be used in specifying the size of some very small circles within the drawing. OK. So now I've got my two arrays for the color palettes. I have two integer variables that are used for determining the sizes of objects in the drawing and then I have some specifications for the window itself. Next, I'm going to come down and draw a rectangle. What I'm going to do, is I'm going to put that one with a fill of the first item from the palette, then the rectangle and then I'm going to start by putting this one way up in the corner 0, 0 starts in the origin of the top left and then it will be "s" or 80 pixels wide and 80 pixels tall.

I'm using the variable "s" for that; so when I do that there is my rectangle, right up there in the corner. And what I'm also going to do, is I'm going to draw a small dot to indicate where the origin is because as you see on some of these, the origin is going to be moving around a little bit. So I'm going to do fill, actually I'll just copy this and this one, I'm going to make palette the fourth color and I'll put ellipse, and the ellipse will be right on the origin and it is going to be "d" for diameter across and down.

So now, when I draw it, you see at least a quarter of a small orange circle at the 0, 0 origin point in the drawing. Now what I'm going to show you is that you can translate, that is you can move over the origin point. So if you don't want to origin at the side of the top, say for instance, you want it in the middle, you can move it around. So we're just going to show how to translate and what I'm going to do right here is I type in the function translate and then, I specify how many pixels over and down I want it to move.

If you wanted to go straight to the center of the drawing, you can do like this width/2 and height/2 and what that would do is it would put the origin right at the middle of the sketch. What I'm going to do however, is I'm going to move it over not quite so far. I'm going to move it over just 40 pixels over and 90 pixels down. And then what I'm going to do, is I'm going to copy these commands right here. The only thing I'm going to do is I'm going to change the palette color for the rectangle, I save it and run that and now, you can see I have a second rectangle a second square, that's drawn lower and slightly to the right of the first one.

However, the orange dot for this one is still on the 0, 0 origin point. And so, I haven't moved the rectangle per se, I've shifted the entire grid for the drawing and now this is going to be a very helpful way if you have an entire collection of shapes that together form an object and they can stay in orientation this way. The next transformation we're going to do is to change the scale of the grid that we're dealing with. I'm going to do this one, by copying some of this text up here and bringing it down.

We're going to translate again, to move the origin over because I want to be able to show exactly, where the origin is at each point. We'll go 140 to the right and then, we'll go -70 to bring it back up a little bit. But then I'm going to add a second transformation. I'm going to put a scale and I'm just going to put a 2 to make it all twice as big, 2 and now it'll be twice as big and I'm going to switch the palette to get to the third color for the rectangle. I save that and press Run, and now I have yet another rectangle and please note, I'm using the exact same parameters for the rectangle, it is still located at 0, 0 with a size of "d" on both sides, that's the same on all of them.

What I'm doing is I'm moving the origin point, and I'm also changing the size of the grid. Now there is one interesting thing here, you may have noticed that not only did the square get twice as big, the circle got twice as big, and it's possible that you don't want the circle to get bigger. And so what you can do is you can actually undo the transformation of scale, before you draw the circles, I'm going to do that right here by copying this part scale and all you need to do to get back to where you are is use the reciprocal. So the reciprocal of two is one half.

I'm going to write that as .5 and what we get is that the dot stays the same size even though the rectangle has changed. This can be a good way of maintaining some of the cohesion between the elements in your design. The last thing that I want to show you is, that you can actually rotate the grid as well. So I'm going to copy this code right here, I'll change this one to rotate, I'm going to translate this one more time, to move the point of origin over from where it is on the large yellow circle.

To do that, I'm going to go translate. Instead of 140, I'm going to move it over a fair amount to 280 and I'm going to add 10 and again, this is relative to the last transformation to that point of origin. I'm going to change the scale a little bit. I'm going to change it to 1.33 and then, I'm going to add another command here, where we rotate and then what rotating does, is it rotates the entire grid from the 0, 0 origin point and it rotates it clockwise.

And when we dealt with arcs a while ago, you remember that we had to specify things in radians. And radians work on units of PI. So halfway around the circle is PI and all the way around the circle is 2x PI and 90 degrees is .5 PI and so on. What I'm going to do in this one, is I'm going to make just a small rotation. I'm going to type in PI which needs to be in capital letters, I'm going to multiply times .5, so I'm going to do just a quarter PI, a small rotation.

Now, if you want to, you do have the option of writing that out in degrees. You can do rotate and then, you can use a radians function and you can take 90 degrees and that will take 90 degrees translate into radians for you either way, it works, I'll comment that out just for right now. And then I'm going to look at my palette, I'm going to go to back to color 1 on this, and still 0, 0 and s, s and I can hit draw and but first I see that I've missed a semicolon up here, to finish that off.

All right, and now I can hit draw and what you see is that this last rectangle has rotated itself and it's done it not by rotating the angle per se, I didn't need to use a quadrangle functions instead of the square. I was able to rotate the entire grid for this. Now if I continued to add more squares, they would be on the same rotated and rescaled grid. But this lets you know that sometimes instead of changing the shape that your drawing, it's easier to change the entire grid on what it is drawn and your shape will follow it, that's one of the interesting pieces of flexibility in Processing, and something you can exploit in your own sketches.

There are currently no FAQs about Interactive Data Visualization with Processing.

 
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

join now Upgrade now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Interactive Data Visualization with Processing.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Notes cannot be added for locked videos.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.