Code Monkey home page Code Monkey logo

circhist's Introduction

CircHist

CircHist - circular / polar / angle histogram in MATLAB

DOI

View CircHist - circular / polar / angle histogram on File Exchange

CircHist creates circular (polar) histograms from angle data, either distribution data or already-binned data. Works with circular and axial (bimodal) data. Circular statistics (average angle, 95 % confidence interval, resultant vector length, Rayleigh test of uniformity and circular-linear correlation) are automatically calculated using the CircStat Toolbox and are graphically included. All visual properties can be dynamically adjusted; see @CircHist/html/exampleCircHist.html for usage examples. This function is conceptually similar to MATLAB's rose and polarhistogram functions, but differs from them in several respects:

  • Instead of plotting the histogram bins as wedges, they are plotted as straight bars.
  • The histogram bins can have error bars.
  • The radius-axis scale is shown as a straight scale next to the plot.
  • Circular statistics are automatically computed.
  • Arrows with specific direction and length can be overlayed.

Requires:

circhist's People

Contributors

zifredder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

circhist's Issues

Plot a triangular marker at the plot edge at a specified angle

As an alternative to the average-angle line, a specific angle could be marked with a triangle that is placed just outside the plot edge whose corner points to this angle.
There will be overlap conflicts with the 95% CI line and the scale bar that need to be taken care of, though.

Issue plotting mean of circular data

When I specify "areAxialData" as "false, " I receive a circular mean result that does not make any sense for my circular data. But this is not the case when "areAxialData" is "true." The range of my data is [-180 180]
img1
img2

Changing the plot title should trigger drawScale()

If the title is adjusted and is changed in height, the axes will automatically re-position, which usually messes up the scale position.
This would probably be best handled with events/listeners. Possibly, it would be optimal to have any change of the axes' position to trigger an event that triggers self.drawScale(), which would cover the case where the axes' title is adjusted.

Add parameter 'drawScale'

Add input parameter 'drawScale', true|false, which defines a priori whether the scale should be drawn. If not, the plot area will not be rescaled to make room for the bar.
Also, if this property is changed after construction, adjust the plot size accordingly: If it is turned on, decrease the size and draw the bar. If it is turned off, increase the size (trying to restore the original position will probably be hard to impossible) and delete the scalebar; also, set 'drawScale' to false when the scalebar is deleted.
This would have the advantage that histograms where the scale is not desired are not automatically downsized, efficiently using the figure space.

Plot more than one distribution into the same histogram

It would be nice to be able to add data sets as separate distributions to an existing histogram.
TODO:

  • To have all distributions be visible, the bars should not occlude each other. To set an alpha value for the bars, the fourth 'colorBar' entry can be set: http://undocumentedmatlab.com/blog/plot-line-transparency-and-color-gradient. This would apply to other elements that might occlude each other, too, such as the CI lines.
  • When the graphics objects are redrawn, the associated procedures must be adjusted to redraw each distribution. This could be implemented by using static (re)draw functions that are called on each CircHist object in the axes (stored in the 'UserData' property).
  • The function 'addData' (or so) adds a distribution, supporting both raw angle distributions and already-binned data, with additional arguments.
  • Calling the constructor with a target axes that is already used by a CircHist object should trigger 'addData' with the specified parameters, thereby adding the passed data. Checking for an existing distribution could be done via the axes' 'UserData' property.
  • Bar colors should be automatically rotated analogous to MATLAB's behavior when additional graphics objects are added to existing objects, provided the colors are not specified.
  • Distribution of different types should be combinable, e. g., a circular distribution with a circular average angle and an axial distribution with an axial average angle should be able to exist in the same histogram.
  • It needs to be asserted that all distributions have the same 'histType', else they could not have the same scale bar. Having several scale bars that apply to different distributions is conceivable, but would probably be very complicated and does not seem necessary to me at the moment.
  • Each CircHist object represents one distribution with the associated data and an axes can be parent of several CircHist objects; hence, all (most?) drawing operations need to be able to handle drawing several distributions.

Increase performance of 'setRLim'

When 'setRLim' is called, existing graphics objects are updated by deleting them and plotting them again with updated data. This could be sped up (presumably by a great factor) by updating the respective graphics objects instead of re-plotting.
The affected methods are: 'drawWhiteDisk', 'drawBars', 'drawBaseLine'.

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.