How to plot histogram from list?
Given a list of numbers, such as [5,3,6,1,...]
, how can I create a histogram from them and show it directly in the notebook interface?
Clarification: 5, 3, 6, 1, ... should not be used for the heights of bars. Instead, the data should be binned first to create a histogram.
Given a list of pairs, such as [[2,3], [4,5], ...]
, how can I create a 2D histogram form them and show it as a plot similar to this? (I.e. clearly distinguish zero counts from small non-zero counts, and show it as a matrix plot, not as a 3D bar chart.)
Clarification: How can I use a colour scheme in matrix_plot
that will clearly differentiate between zero and non-zero values? E.g. use white for zero and some colour gradient for non-zero. 0
and 0.0001
should show clearly differently. How do I achieve this with the cmap
parameter?
R is good for visualizing statistics. It is included in sage: http://ask.sagemath.org/question/7805/how-to-use-r-with-sage/
@Thomas Thanks, that's probably what I will do.
As to your update on the cmap parameter, I think you may have to look for a cmap that does this. See http://matplotlib.org/examples/color/colormaps_reference.html and you can also design a custom cmap, see e.g. http://stackoverflow.com/questions/9707676/defining-a-discrete-colormap-for-imshow-in-matplotlib