Browse Source

added copyright information to the sources as well as a help and explanation messages to xkcdify.m

pull/2/merge
Stuart Layton 11 years ago
parent
commit
bad147bca1
2 changed files with 39 additions and 4 deletions
  1. +26
    -2
      xkcdify.m
  2. +13
    -2
      xkcdify_example.m

+ 26
- 2
xkcdify.m View File

@@ -1,4 +1,29 @@
function xkcdify(axHandle)
%XKCDIFY convert an existing axes to an XKCD style axes
%
% XKCDIFY( AXES ) re-renders all childen of AXES to have a hand drawn
% XKCD style, http://xkcd.com, AXES can be a single axes or a vector of axes
%
% NOTE: Only plots of type LINE and PATCH are re-rendered. This should
% be sufficient for the majority of 2d plots such as:
% - plot
% - bar
% - boxplot
% - etc...
%
% NOTE: This function does not alter the actual style of the axes
% themselves, that functionality will be added in the next version. I
% still have to figure out the best way to do this, if you have a
% suggestion please email me!
%
% Finally the most up to date version of this code can be found at:
% https://github.com/slayton/matlab-xkcdify
%
% Copyright(c) 2012, Stuart P. Layton <stuart.layton@gmail.com> MIT
% http://stuartlayton.com

% Revision History
% 2012/10/04 - Initial Release

if nargin==0
@@ -10,8 +35,7 @@ function xkcdify(axHandle)

pixPerX = [];
pixPerY = [];
axChildren = get(ax, 'Children');
operate_on_children(axChildren, ax);


+ 13
- 2
xkcdify_example.m View File

@@ -1,3 +1,15 @@
% This file contains a simple Matlab script that demonstrates how to use
% xkcdify.m
%
% The most up to date version of this file can be found at
% https://github.com/slayton/matlab-xkcdify
%
% Copyright(c) 2012, Stuart P. Layton <stuart.layton@gmail.com>
% http://stuartlayton.com
%
% Revision History
% 2012/10/04 - Initial Release


%% - Example 1, XKCDify simple line plots
clear;
@@ -61,7 +73,7 @@ xkcdify(gca)
%% - Example 4, XKCDify a subset of axes inside a figure

clear; close all; clc;
figure('Position', [300 500 800 300]);
figure('Position', [100 460 1120 420]);
x = 0:.1: 2 * pi;
y1 = sin(x);
y2 = cos(x);
@@ -72,7 +84,6 @@ for i = 1:3
plot(x * i, sin(x ./ (i/2)), x*i, cos(x ./ (i/2)), 'Parent', a(i), 'linewidth', 4);
set(a(i), 'XLim', [x(1) - .25, x(end)+.25] * i, 'YLim', [-1.2 1.2]);
end

xkcdify(a(2:3))




Loading…
Cancel
Save