Giter Site home page Giter Site logo

pqplot's Introduction

PQPLOT

Some functions for easily generating publication quality plots in Matlab with all of the set() and get() stuff built in.

  • This is in no way a flexible package ready for general use. I've just been creating functions here and there based on my needs at the time.
  • Currently, this uses the viridis colourmap

Examples

Scatterplot

Scatterplots can be created with the pqscatter function. Title can be added with the pqtitle function, which takes the pqplot object s (in the example below) as the first argument.

% Creating a PQ ScatterPlot
rng(123);
x = randn(100, 1);
y = 1.5*x + 0.2*randn(100, 1);

figure();
s = pqscatter(x, y);
pqtitle(s, 'PQ Scatter Plot');
xlabel('X Label');
ylabel('Y Label');

Actual vs. Estimate Scatterplots and Plotting Least Squares Regression Lines

This function was originally created to compare accuracy of a model-fitting algorithm's parameter estimates compared to the true ones. As such, there exists an option third argument in pqscatter which accepts a cell array containing one or more of 'match', which plots a diagonal line from the origin to the top right-hand corner, or 'lm' which plots an ordinary least-squares regression line to the data series.

% Creating an Actual vs. Estimate PQ ScatterPlot

rng(123);
x = randn(100, 1);
y = 1.5*x + 0.2*randn(100, 1);

figure();
s = pqscatter(x, y, {'match'});
pqtitle(s, 'PQ Actual vs. Estimate Plot');
xlabel('Actual');
ylabel('Estimate');

% Creating an Actual vs. Estimate PQ ScatterPlot with an additional least squares fit line

rng(123);
x = randn(100, 1);
y = 1.5*x + 0.2*randn(100, 1);

figure();
s = pqscatter(x, y, {'match', 'lm'});
pqtitle(s, 'PQ Actual vs. Estimate Plot');
xlabel('Actual');
ylabel('Estimate');

Plotting multiple series with pqscatter

Just have y be a matrix with each series you wish to plot as an individual column in that matrix.

% Plotting multiple series with pqscatter

rng(123);
x = randn(100, 1);
y = meshgrid(0.5:2.5, 1:100).*repmat(x, 1, 3) + 0.2*randn(100, 3);

figure();
s = pqscatter(x, y, {'match', 'lm'});
pqtitle(s, 'PQ Actual vs. Estimate Plot');
xlabel('Actual');
ylabel('Estimate');

Bar Plots

Bar plots can be created with the pqbar function

% Bar plot with pqbar()

rng(123);
labelsx = {'A', 'B', 'C'};
y = rand(1, 3)*10;

figure();
s = pqbar(labelsx, y);
pqtitle(s, 'PQ Bar Plot');
ylabel('Values');

The pqbar function can also plot multiple series per xlabel. Just add each series as a new column in the array y:

% Bar plot with pqbar()

rng(123);
labelsx = {'A', 'B', 'C'};
y = rand(3, 5)*10;

figure();
s = pqbar(labelsx, y);
pqtitle(s, 'PQ Bar Plot Multi-Series');
ylabel('Values');

pqplot's People

Contributors

abrahamnunes avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.