ggplot in Python- Part 1.

As a part of my internship, I have study the basic functions in ggplot using the predefined data sets. But, before we dive into the analysis, let us first know what is ggplot all about.

What is ggplot?

ggplot is a plotting system in R, created by H. Wickman in 2005. Since then it has grown and has been exported to Python and SAS. ggplot is build along the lines of easy to pull visualizations with minimal code. It has very flexible features which allow the user to customize the theme and layering. Throughout out series of evaluation, we will focus on ggplot in python.

To cut the long story short

EASY+FUN+POWERFUL+VERSATILE = ggplot.

System Prerequisites:

  • pip
  • matplotlib
  • pandas
  • numpy
  • scipy
  • statmodel
  • ipython/ipython notebook( preferred but not necessary)

Installing ggplot

METHOD 1: pip install ggplot

METHOD 2:  pip install git+git://github.com/yhat/ggplot.git

Basic Components of ggplot:

  • ggplot API– Easy to use interface, prevents need to granular coding.
  • Data– Data set in ggplots are handled as Data Frames, same as in pandas. Infact for most of the part(which is necessary as well), ggplot works in close association with pandas.
  • Asthetics– The help in determining how our plot is going to look, from limits of axis es to title and themes.
  • Layers– The initial plot is just a square segment of x-y system. We can then add layers of information(i.e one piece of information over another).

Our Data set– ggplot comes with a number of data sets that we use for our learning. We shall use the diamond data set for our evaluation.

Import necessary packages.

ppt1

Check for our data set:

INPUT: diamonds?

OUTPUT:

ppt14

With our data set in place. We are ready to explore more.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s