/sorting-visualizer-matplotlib

Scripts to visualize sorting algorithms using matplotlib animations

Primary LanguagePythonMIT LicenseMIT

Matplotlib sorting visualizer

Scripts to visualize sorting algorithms using matplotlib animations

Bar graph

Scatter graph

Algorithms available

  • Bubble sort
  • Quick sort
  • Heap sort
  • Intro sort

About

The aim of this project is to make sorting algorithms easier to visualize and understand, using the animation capabilities of matplotlib.

Dependencies

Manual

  • Install Matplotlib and Celluloid(if not already installed) pip install celluloid pip install matplotlib

  • Install ImageMagick or ffmpeg(optional)

  • Run main.py

python main.py

  1. (To run with defaut values just press enter)
  2. Select Data size(default 30)
  3. Select the algorithm(defaut is quicksort)
  4. Select the type of graph(defaut bar graph)
  5. Choose if you want to save

How to contribute

  1. Put new algorithm on root
  2. Import Plot from animate
  3. Use Plot function in algorithm function
  4. Add algorithm to algorithms in main file
  5. Add algorithm title in animate file