NewtFire logo: a mosaic rendering of a firebelly newt
newtFire {dh}
Creative Commons License Last modified: Monday, 08-Nov-2021 15:23:55 UTC. Maintained by: Elisa E. Beshero-Bondar (eeb4 at psu.edu). Powered by firebellies.

For this assignment, choose one of the following options:

  1. Follow Obdurodon’s tutorial to try your hand at making a Bubble Plot.
  2. Or, plot a bar graph with an X and a Y axis, labelled with a title and units, that represents data you pull from your project files using XQuery. Spend some time studying the code and structure of the files and experiment with something interesting to plot. Or...
  3. Or, plot an SVG visualization of your choice that shows us something interesting in the project files. Your XQuery needs to be more complicated than one or two XPath expressions, and should involve some use of a for loop, but otherwise the form your plot takes is entirely up to you. Whatever you plot must involve some use of XQuery variables and calculations to pull information from the XML code and output it as SVG. Use SVG <text> elements to title and label your plot.

Preparation

It may help you to watch my recorded video on how to plot hash marks along X and Y axes on an SVG plot working with XQuery:

You should update your project files into our eXist database to work on for this assignment.

Before you start coding the XQuery, spend a few minutes studying your XML code. Look for something interesting to count and plot. Because the XML texts that we are using here are under development, they may be inconsistently or incompletely marked up. They are all well formed, however, which means that they can be explored with XML tools, including XQuery.

The dimensions and style of your plot are up to you, though we recommend a bar graph be used for most plots of counts. Save your SVG output in eXist, but paste a copy of your XQuery script in a text file, save it according to our usual homework file naming conventions, and upload it to Coursweb.

Plotting SVG from XQuery:

Draw your X and Y axes, and set up a Viewport

Work out your maximum values for X and Y and set a view port with a width and a height, and then a viewBox attribute to scale your output if you wish.

Look at examples of how we prepared SVG Viewports in class, and check out Sara Soueidan’s excellent detailed explanation. Here is a brief summary overview of how to set the Viewport attributes on the SVG root element:

Now, if I want to define how the image behaves on a screen, I define the viewBox attribute. viewBox takes four values: viewBox="(x1,y1,x2,y2)" which define a new coordinate system to use in rendering our output image.

General Pointers

To plot your graph in SVG from XQuery, apply what you have been learning about SVG in the previous assignments. Keep in mind the following: