Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Bounty Awarded with 200 reputation awarded by bla
added 15 characters in body
Source Link
slayton
  • 20.3k
  • 11
  • 63
  • 90

Rather than re-implementing all the various plotting functions I wanted to create a generic tool that could convert any existing plot to a xkcd style plot.

This approach means that you can create plots and style them using standard MATLAB functions and then when you're done you can then re-render the plot in an xkcd style while preserving the overall style of the plot.

Examples

Plot Enter image description here

Bar & Plot

Enter image description here

Box & Plot Enter image description here

How it works

The function works by iterating over the children of an axes. If the children are of type line or patch it distorts them slightly. If the child is of type hggroup it then iterates on the sub-children of the hggroup. I have plans to support other plot types, such as image, but it's not clear what is the best way to distort image to have an xkcd style.

Finally to ensure that the distortions look uniform (that is, short lines aren't distored more than long lines), I measure the 'line'line length in pixels and then up sample proportional to its length. I can then add noise to every N samplesNth sample which produces lines that look good regardlesshave more or less the same amount of how long they aredistortion.

The Code

Rather than pasting ~300several hundred lines of code I'll just link to a gist of the source. Additionally the source code and the code to generate the above examples are freely available GitHub.

As you can see from the examples, it doesn't yet distort the axes themselves although I plan to implement as soon as I figure out the best way to do that.

Rather than re-implementing all the various plotting functions I wanted to create a generic tool that could convert any existing plot to a xkcd style plot.

This approach means that you can create plots and style them using standard MATLAB functions and then when you're done you can then re-render the plot in an xkcd style while preserving the overall style of the plot.

Examples

Plot Enter image description here

Bar & Plot

Enter image description here

Box & Plot Enter image description here

How it works

The function works by iterating over the children of an axes. If the children are of type line or patch it distorts them slightly. If the child is of type hggroup it then iterates on the sub-children of the hggroup. I have plans to support other plot types, such as image, but it's not clear what is the best way to distort image to have an xkcd style.

Finally to ensure that the distortions look uniform (that is, short lines aren't distored more than long lines), I measure the 'line' length in pixels and then up sample proportional to its length. I can then add noise every N samples which produces lines that look good regardless of how long they are.

The Code

Rather than pasting ~300 lines of code I'll just link to a gist of the source. Additionally the source code and the code to generate the above examples are freely available GitHub.

As you can see from the examples, it doesn't yet distort the axes themselves although I plan to implement as soon as I figure out the best way to do that.

Rather than re-implementing all the various plotting functions I wanted to create a generic tool that could convert any existing plot to a xkcd style plot.

This approach means that you can create plots and style them using standard MATLAB functions and then when you're done you can then re-render the plot in an xkcd style while preserving the overall style of the plot.

Examples

Plot Enter image description here

Bar & Plot

Enter image description here

Box & Plot Enter image description here

How it works

The function works by iterating over the children of an axes. If the children are of type line or patch it distorts them slightly. If the child is of type hggroup it then iterates on the sub-children of the hggroup. I have plans to support other plot types, such as image, but it's not clear what is the best way to distort image to have an xkcd style.

Finally to ensure that the distortions look uniform (that is, short lines aren't distored more than long lines), I measure the line length in pixels and then up sample proportional to its length. I then add noise to every Nth sample which produces lines that have more or less the same amount of distortion.

The Code

Rather than pasting several hundred lines of code I'll just link to a gist of the source. Additionally the source code and the code to generate the above examples are freely available GitHub.

As you can see from the examples, it doesn't yet distort the axes themselves although I plan to implement as soon as I figure out the best way to do that.

Removed meta information. (its = possessive, it's = "it is" or "it has". See for example <http://www.wikihow.com/Use-Its-and-It's>.)
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

I know I'm late to the game on this one, but I spent a few hours on this so I'm going to share it anyway! :D

Rather than re-implmentingimplementing all the various plotting functions I wanted to create a generic tool that could convert any existing plot to a XKCDxkcd style plot.

This approach means that you can create plots and style them using standard MatlabMATLAB functions and then when you're done you can then re-render the plot in an XKCDxkcd style while preserving the overall style of the plot.

Examples

Plot enter image description hereEnter image description here

Bar & Plot

enter image description hereEnter image description here

Box & Plot enter image description hereEnter image description here

How it works

The function works by iterating over the children of an axes. If the children are of type line or patch it distorts them slightly. If the child is of type hggroup it then iterates on the sub-children of the hggroup. II have plans to support other plot types, such as image, but itsit's not clear what is the best way to distort image to have an XKCDxkcd style.

Finally to ensure that the distortions look uniform (iethat is, short lines aren't distored more than long lines), I measure the 'line' length in pixels and then up sample proportional to its length. I can then add noise every N samples which produces lines that look good regardless of how long they are.

The Code

Rather than pasting ~300~300 lines of code I'll just link to a gist of the source. Additionally the source code and the code to generate the above examples are freely available GitHub.

As you can see from the examples, it doesn't yet distort the axes themselves although I plan to implement as soon as I figure out the best way to do that.

I know I'm late to the game on this one, but I spent a few hours on this so I'm going to share it anyway! :D

Rather than re-implmenting all the various plotting functions I wanted to create a generic tool that could convert any existing plot to a XKCD style plot.

This approach means that you can create plots and style them using standard Matlab functions and then when you're done you can then re-render the plot in an XKCD style while preserving the overall style of the plot.

Examples

Plot enter image description here

Bar & Plot

enter image description here

Box & Plot enter image description here

How it works

The function works by iterating over the children of an axes. If the children are of type line or patch it distorts them slightly. If the child is of type hggroup it then iterates on the sub-children of the hggroup. I have plans to support other plot types, such as image, but its not clear what is the best way to distort image to have an XKCD style.

Finally to ensure that the distortions look uniform (ie short lines aren't distored more than long lines) I measure the 'line' length in pixels and then up sample proportional to its length. I can then add noise every N samples which produces lines that look good regardless of how long they are.

The Code

Rather than pasting ~300 lines of code I'll just link to a gist of the source. Additionally the source code and the code to generate the above examples are freely available GitHub

As you can see from the examples it doesn't yet distort the axes themselves although I plan to implement as soon as I figure out the best way to do that.

Rather than re-implementing all the various plotting functions I wanted to create a generic tool that could convert any existing plot to a xkcd style plot.

This approach means that you can create plots and style them using standard MATLAB functions and then when you're done you can then re-render the plot in an xkcd style while preserving the overall style of the plot.

Examples

Plot Enter image description here

Bar & Plot

Enter image description here

Box & Plot Enter image description here

How it works

The function works by iterating over the children of an axes. If the children are of type line or patch it distorts them slightly. If the child is of type hggroup it then iterates on the sub-children of the hggroup. I have plans to support other plot types, such as image, but it's not clear what is the best way to distort image to have an xkcd style.

Finally to ensure that the distortions look uniform (that is, short lines aren't distored more than long lines), I measure the 'line' length in pixels and then up sample proportional to its length. I can then add noise every N samples which produces lines that look good regardless of how long they are.

The Code

Rather than pasting ~300 lines of code I'll just link to a gist of the source. Additionally the source code and the code to generate the above examples are freely available GitHub.

As you can see from the examples, it doesn't yet distort the axes themselves although I plan to implement as soon as I figure out the best way to do that.

edited body
Source Link
slayton
  • 20.3k
  • 11
  • 63
  • 90

I know I'm late to the game on this one, but I spent a few hours on this so I'm going to share it anyway! :D

Rather than re-implmenting all the various plotting functions I wanted to create a generic tool that could convert any existing plot to a XKCD style plot.

This approach means that you can create plots and style them using standard Matlab functions and then when you're done you can then re-render the plot in an XKCD style while preserving the overall style of the plot.

Examples

Plot enter image description here

Bar & Plot

enter image description here

Box & Plot enter image description hereenter image description here

How it works

The function works by iterating over the children of an axes. If the children are of type line or patch it distorts them slightly. If the child is of type hggroup it then iterates on the sub-children of the hggroup. I have plans to support other plot types, such as image, but its not clear what is the best way to distort image to have an XKCD style.

Finally to ensure that the distortions look uniform (ie short lines aren't distored more than long lines) I measure the 'line' length in pixels and then up sample proportional to its length. I can then add noise every N samples which produces lines that look good regardless of how long they are.

The Code

Rather than pasting ~300 lines of code I'll just link to a gist of the source. Additionally the source code and the code to generate the above examples are freely available GitHub

As you can see from the examples it doesn't yet distort the axes themselves although I plan to implement as soon as I figure out the best way to do that.

I know I'm late to the game on this one, but I spent a few hours on this so I'm going to share it anyway! :D

Rather than re-implmenting all the various plotting functions I wanted to create a generic tool that could convert any existing plot to a XKCD style plot.

This approach means that you can create plots and style them using standard Matlab functions and then when you're done you can then re-render the plot in an XKCD style while preserving the overall style of the plot.

Examples

Plot enter image description here

Bar & Plot

enter image description here

Box & Plot enter image description here

How it works

The function works by iterating over the children of an axes. If the children are of type line or patch it distorts them slightly. If the child is of type hggroup it then iterates on the sub-children of the hggroup. I have plans to support other plot types, such as image, but its not clear what is the best way to distort image to have an XKCD style.

Finally to ensure that the distortions look uniform (ie short lines aren't distored more than long lines) I measure the 'line' length in pixels and then up sample proportional to its length. I can then add noise every N samples which produces lines that look good regardless of how long they are.

The Code

Rather than pasting ~300 lines of code I'll just link to a gist of the source. Additionally the source code and the code to generate the above examples are freely available GitHub

As you can see from the examples it doesn't yet distort the axes themselves although I plan to implement as soon as I figure out the best way to do that.

I know I'm late to the game on this one, but I spent a few hours on this so I'm going to share it anyway! :D

Rather than re-implmenting all the various plotting functions I wanted to create a generic tool that could convert any existing plot to a XKCD style plot.

This approach means that you can create plots and style them using standard Matlab functions and then when you're done you can then re-render the plot in an XKCD style while preserving the overall style of the plot.

Examples

Plot enter image description here

Bar & Plot

enter image description here

Box & Plot enter image description here

How it works

The function works by iterating over the children of an axes. If the children are of type line or patch it distorts them slightly. If the child is of type hggroup it then iterates on the sub-children of the hggroup. I have plans to support other plot types, such as image, but its not clear what is the best way to distort image to have an XKCD style.

Finally to ensure that the distortions look uniform (ie short lines aren't distored more than long lines) I measure the 'line' length in pixels and then up sample proportional to its length. I can then add noise every N samples which produces lines that look good regardless of how long they are.

The Code

Rather than pasting ~300 lines of code I'll just link to a gist of the source. Additionally the source code and the code to generate the above examples are freely available GitHub

As you can see from the examples it doesn't yet distort the axes themselves although I plan to implement as soon as I figure out the best way to do that.

added 18 characters in body
Source Link
slayton
  • 20.3k
  • 11
  • 63
  • 90
Loading
added 171 characters in body
Source Link
slayton
  • 20.3k
  • 11
  • 63
  • 90
Loading
Source Link
slayton
  • 20.3k
  • 11
  • 63
  • 90
Loading