Design reusable parameterised functions

Assignment Help Python Programming
Reference no: EM13909546

Task: Bubble Charts

Overview

One of the most basic functions of any IT system is to process a given data set to produce some form of human-readable output. This task requires you to produce a visual image based on data stored in a list. It tests your abilities to:

• Iterate through sequences of data values;
• Perform arithmetic operations;
• Display information in a visual form; and
• Produce reusable code.

These same skills, which you will acquire by completing this task at home, will subsequently be tested under time pressure in the Week 7 "in-class test."

Goal

You are required to write a Python program which processes data stored in a list to produce a "bubble chart." Bubble charts are a common way to visually display data sets that have values in three dimensions. They extend the familiar notion of a scatter plot, used to display two-dimensional data on an x-y coordinate system, to include a third dimension by varying the sizes of the dots on the chart. In our case, however, we will not draw simple "bubbles" (dots), but will use the abilities of Turtle graphics to show the bubbles as icons which visually represent the data items whose values they portray.

The data values to be displayed each consists of a quadruple, specifying the icon style, and the corresponding x, y and z components for this data item. You are required to use Turtle graphics to draw a corresponding bubble chart for each icon in a list, where the x and y values determine the position of the icon and the z value determines its size. Each icon drawn must precisely match the dimensions specified, and each icon must be clearly distinct. Your program must work for any of the given data sets, and any other similar data sets in the same format. You have a free choice in the style of icons to be displayed, however.

Specific requirements

To complete this task you are required to extend the given bubble_charts.py template file by completing the function draw_bubble_chart so that it can draw bubble charts by following a given data set that specifies the style and dimensions of the icons to be displayed. In addition, your chart must include a legend explaining what each of the icons denotes.

To get started, you first need to choose a collection of five icons to draw. These must all be related in some way, must clearly be evocative of the subject they are intended to represent, and must be non-trivial. Simple geometric shapes, such as squares, circles, etc, are not acceptable. Suggested sources of ideas for sets of icons include the following.

• Comic or cartoon characters

• TV shows

• Sporting teams

• Political parties

• Countries or states

• Brands of commercial products, e.g., soft drinks, fast food, etc

• Automobile makes

• Games

• Companies, e.g., airlines, banks, etc

• Educational institutions, e.g., universities or high schools

• Media brands, e.g., newspapers, magazines, etc

Other ideas are welcome, provided that they involve a set of non-trivial, clearly-distinct icons.

Your submitted solution will consist of a single Python file and must have at least the following features.

• It must produce at least five different styles of icon. The icons must be clearly distinct in colour and shape. The icons must be non-trivial, i.e., they must not be simple geometric shapes such as circles and squares. We would expect that each icon would comprise at least two separate shapes and colours, typically more. Effort should be put into making your drawing of the icon look like the "real" one. (We admit that our Turtle-based drawing of Superman's emblem is far from perfect, but it is still clear which superhero it represents!)

• When your draw_bubble_chart function is called with a particular data set, the icons must be drawn to precisely match the specifications in the data set in terms of their style, position and size. Importantly, all features of each icon must scale proportionately when it is drawn at different sizes.

• You may not import any modules or files into your program other than those already included in the given bubble_charts.py template. In particular, you may not

import any image files for use in creating your icons. All five icons must be drawn using basic Turtle graphics functions only.

• The legend must be easy to read and understand and must clearly identify what each icon represents.

• Your solution must work for all of the given data sets. You may not change the data sets provided, but you can add additional sets if you like.

• Your program code must be presented in a professional manner. See the coding guidelines in the IFB104 Code Marking Guide (on Blackboard under Assessment) for suggestions on how to achieve this. In particular, given the obscure and repetitive nature of the code needed to draw complex images using Turtle graphics, each significant code segment must be clearly commented to say what it does, e.g., what feature of the icon the corresponding code produces.

Most importantly, you are not required to copy the set of icon styles shown in this document. Instead you are strongly encouraged to be creative and to choose your own set of icons from some area that interests you personally.

Development hints

• This is not a difficult task, but due to the need to create multiple icon styles that can be drawn at different sizes, it would be very repetitive if you tried to code the whole solution using ‘brute force.' Instead you are strongly encouraged to design reusable parameterised functions to draw the icons to reduce the amount of code you need to write. (And obviously you should aim to use the same functions to draw the icons in the legend and on the chart.)

• To draw the icons you must use only the basic Turtle drawing functions. You may not import any image files into your code. In our "superheroes" demonstration we created Batman's emblem by varying the shape and colour of the turtle and "stamping" it onto the screen; the icon is made of an oval (actually a stretched circle), a rectangle (a stretched square), and several triangles. On the other hand, Superman's shield was produced just by moving the turtle to draw individual lines.

• If you are unable to complete the whole task, just submit whatever parts you can get working. You will receive partial marks for incomplete solutions. (The hardest part of this task is making the icons scalable to different sizes, so you may want to leave this to last.)

• To help you debug your code we have provided some data sets which don't produce realistic looking bubble charts, but allow you to clearly see the dimensions of your icons. In particular, data sets 0 to 4 each draw one icon at different sizes, so you can use these to guide your development of each icon style.


Attachment:- bubble_charts.rar

Reference no: EM13909546

Questions Cloud

Help of an enzyme produced within a cell : The maltose molecule can be broken down into two individual glucose molecules with the help of an enzyme produced within a cell. Which of the following changes is most likely to slow down this reaction?
Hydrophobic end and a hydrophilic end : An analysis of a lipid shows that it is made up of two fatty acids and a phosphate group, each bonded to a glycerol molecule. The molecule has a hydrophobic end and a hydrophilic end. Based on this information, what conclusion can you draw regardi..
Discuss patterns of communication in your family : Discuss patterns of communication in your family
How can be addressed from a multidisciplinary perspective : Explain how (highly-trained doctors and nurses in the health field today. There is an ever increasing demand for well-trained nurses with doctorate degrees ) can be addressed from a multidisciplinary perspective.
Design reusable parameterised functions : create multiple icon styles that can be drawn at different sizes, it would be very repetitive if you tried to code the whole solution using ‘brute force.' Instead you are strongly encouraged to design reusable parameterised functions to draw the i..
Show that there must be some other state say state two : Show that there must be some other state, say state 2, and some decision, k2, such that P(k2) > 0. Show that there must be some other state, say state 3, and some decision, k3, such that either P(k3) > 0 or P(k3)> 0.
Gathering and analyzing secondary data : The response should include :gathering and analyzing secondary data, creating a tool or instrument to gather and analyze primary data, gathering related research and preparing a literature review, preparing and analyzing tables, charts, and suppor..
Ideology influences constitutional law : After reading the landmark decisions of Plessy v Ferguson, 163 U.S 537 (1896) and Miranda v Arizona, 384 U.S , 436(1966) discuss the following in a paper of 7 pages what factors influenced each of these decisions read the dissenting opinions as well,..
Separate divisions of plant kingdom : Liverworst and firn both are non-flowerings plants,yet they are classified under separate divisions of plant kingdom. Explain this with special reference to their vascular tissues,and differentiation of the plant body into stem,leaves and roots

Reviews

Write a Review

Python Programming Questions & Answers

  Python scripting language

Your programming project will be a simple, working program, using a Python scripting language, which utilizes a good design process and includes: Sequential, selection, and repetitive programming statements as well as and At least one function call

  Write a program to that displays a table

Write a program to that displays a table of the Celsius temperatures 0 through 20 and their Fahrenheit and Kelvin equivalents

  The function should return the day name (''su'',''mo''..etc)

Write the function day(d,m) where m is an integer from 1 through 12 expressing a month, and d is an integer from 1 through 31 expressing the day part of a date in 2014.

  Do a python project and get it running using app engine

Do a python project and get it running using App engine. Something very basic and simple

  Explain a python program storing and processing simple bank

A Python program storing and processing simple bank records is in the early stages of development. The records are stored in a text file (bank.txt) that contains, for each bank customer, their given name, account number and balance.

  1 why is biodiversity importantnbsp discuss the ways in

1 why is biodiversity important?nbsp discuss the ways in which the value may be assigned to biodiversity. based on your

  Write a non-fruitful function drawequitriangle

Write a non-fruitful function drawEquitriangle(someturtle, somesize) which calls drawPoly from the previous question to have its turtle draw a equilateral triangle

  Question 1 research 5-8 species within one family of birds

question 1 research 5-8 species within one family of birds. be sure to use primary or very good secondary literature

  Look up terms in a tech dictionary

Create a program that allows a user to look up terms in a tech dictionary - programming or scripting that is of interest to you, and complete one or more web-based tutorials on the topic.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Program to do the enciphering

Write a program to do the enciphering. It should prompt the user for a message, and print out both the entered message and its corresponding ciphertext.

  Console program where you will implement

Create a console program where you will implement coding constructs and variables that are needed for this program and will implement the code within Main and any required static methods.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd