Load Example:

px Page width. 481px : 312pt(latex)

title('Load Graph for Solar Cell');
subtitle('four cells of 2.5x5cm');
x_axis('resistances / Ohms');
y_axis('power / Watts');
//load in the data
currents = [70.8,71.1,71.3,71.2,71.3,71.2,71.0,69.2,65.9,59.7,56,54.8,52.9,51.8,48.4,47.4,46.6,44.8,43.3,42.6,40.0,38.1,36.5,35.5,33,27.1,25.6,21.6,6.3];
voltages = [0.109,.461,.8,1.016,1.204,1.333,1.483,1.657,1.783,1.874,1.91,1.915,1.929,1.937,1.958,1.92,1.966,1.976,1.983,1.986,1.994,2,2.01,2.01,2.02,2.04,2.04,2.06,2.09];
//do some maths with it
currents = times(currents,0.001);
resistances = divide(voltages ,currents);
powers = times(voltages,currents);
//call plot
plot(resistances ,powers);
captions('run 1');

// as of version 0_3 MJSplot has basic support for plotting error bars.
//This is an example of working with errors
currents = [70.8,71.1,71.3,71.2,71.3,71.2,71.0,69.2,65.9,59.7,56,54.8,52.9,51.8,48.4,47.4,46.6,44.8,43.3,42.6,40.0,38.1,36.5,35.5,33,27.1,25.6,21.6,6.3];
voltages = [.109,.461,.8,1.016,1.204,1.333,1.483,1.657,1.783,1.874,1.91,1.915,1.929,1.937,1.958,1.92,1.966,1.976,1.983,1.986,1.994,2,2.01,2.01,2.02,2.04,2.04,2.06,2.09];
//convert current in mA to A
currents = times(currents,0.001);
//define some errors
//repeat(a,b) make an array containg a repeated b times. e.g. repeat(1,5) = [1,1,1,1,1]
current_errors = repeat(0.001,currents.length);
//a 10% error
voltage_errors = times(0.01,voltages);
//find resistance and power.
resistances = divide(voltages ,currents);
powers = times(voltages,currents);
//qadd() returns the square root of the some of the item squared. element wise.
//as we are are multiplying and dividing we use the fractional error.
relitive_errors = qadd( divide(voltage_errors,voltages), divide(current_errors,currents) );
resistance_errors = times(resistances,relitive_errors);
power_errors = times(relitive_errors,powers)
//plot in the form (x, y, yerror, xerror), or just (x,y), or (x,y,yerror)
//as well as plot() we can pick loglog(), semilogx(), and semilogy().
//these are all the same but change the axis modes.
semilogx(resistances ,powers,power_errors,resistance_errors);
//call things to set text on the graph.
captions('run 1');
title('Load Graph for Solar Cell');
subtitle('four cells of 2.5x5cm');
x_axis('resistances / Ohms');
y_axis('power / Watts');

// time data
//you can use http://www.lancaster.ac.uk/pg/sarsby/MJSplot/tools/time.html
//to find valid time strings
datetimes_stings = ['Jan 2 2015','Feb 3 2015', 'May 13 2015'];
counts = [123,142,165];
//like plot(x,y) just use timeseries(x,y)
timeseries(datetimes_stings,counts);
captions('counts')
title('time example');
subtitle(' ');
x_axis('');
y_axis('counts');

// About //
/*
This is a two evening hack.
Inspiration came from my students hating Origin for data analysis.
For the level of analysis they need, just importing, a few element
wise manipulations, and
simple plotting/printing is all that is needed.
The text editor is ACE:
http://ace.c9.io
The plotting program is my own MJSplot:
http://www.lancaster.ac.uk/pg/sarsby/MJSplot/index
I've written an interface to the usual plot commands and styling
commands to that it is more intuative.
You are welcome to look at the source to this page in horrow.
Everything is done client side, so you can see all
the glue code and hacky methods.
MJS 2015
*/

//There are a few built in that are avaliable.
//we can use the range(start,stop,points) to generate data
points = 100;
x_points = range(50,100,points);
y_points = range(1,10,points);
plot(x_points,y_points);
captions('raw');
// we can log some data
logged_y = log(y_points);
plot(x_points,logged_y);
captions('logged y');
//other avaliable functions are divide(x,y), times(x,y), add(x,y), and sub(x,y).
//log(x), sqrt(x), sqr(x),
//we can apply generic funcitons using evaluate(function,xarray,yarray)
//where function is a string of a expression using log,ln,sin,cos,tan,pi,e,sqrt
shifted_y = evaluate('sin(x)/(1+y)',x_points ,y_points);
plot(x_points,shifted_y);
captions('squiggly y');
//this means you can do:
//resistances = evaluate('x/y',voltages ,currents);
//evaluate() also works on single arrays
//the first array has points called x still, so:
half_y = evaluate('x/2',y_points);
//is the same as
other_half_y = divide(y_points,2);
plot(x_points,half_y);
captions('half y');
title('Functions');
subtitle('example');
x_axis('x');
y_axis('y');

All font sizes should be the same. Don't change this.

Open with Inkscape, make your annotatoins, and save to pdf + latex