I have a plot with two histograms. However, it is difficult to tell which histogram on the plot is coming from the first set of data and which graphs the second set of data. There is a different colored line for each histogram: one is blue, and the other is green. Does the default MATLAB 'ColorOrder'
vary between devices? If not - what is the order?
相关问题
- Extract matrix elements using a vector of column i
- Plotting multiple columns with ggplot2 [duplicate]
- DBGrid - How to set an individual background color
- How do you get R's null and residual deviance
- R markov chain package, is possible to set the coo
相关文章
- How to plot smoother curves in R
- How to add clipboard support to Matplotlib figures
- Adding a legend to a matplotlib boxplot with multi
- Emacs/xterm color annoyance on Linux
- How do I append metadata to an image in Matlab?
- matplotlib bwr-colormap, always centered on zero
- How can I write-protect the Matlab language?
- `std::sin` is wrong in the last bit
There exists a colormap for this specific purpose -
lines
(Introduced before R2006a). Here's whatlines.m
says:If you open the documentation of
lines
, you can see a preview image that looks very much like what appears in rayryeng's answer:Thus, as long as you're using the default
colormap
, to know the colors of the firstn
lines, all you need to do is calllines(n)
.Good question! There is a default colour order for MATLAB. Take note that versions before R2014b, the default colour order for MATLAB uses the jet colour map. In the jet colour map, the first plot is blue, followed by the second plot being green. For versions after R2014b, this follows the parula colour map, where the first plot would be a lighter blue followed by the second plot being a copper orange of sorts. If you actually want to know what the colour order is for your plot, make sure the plot is open in MATLAB, then do the following:
This will return a 2D matrix where each row gives you the proportion of red, green and blue for each plot that you produce. On my machine at the time of this post when I was running MATLAB R2013a and with Mac OSX 10.9.5, this is what I got:
Each row gives you the red, green and blue values for a particular colour. The first row denotes the first colour to go on the plot, followed by the second row denoting the second colour and so on.
As such, the above colour order is:
Currently (March 10th, 2016), I am using MATLAB R2015a and this is the colour map I get:
The RGB tuples in this case are slightly more complex and so it's hard to infer what they are by just looking at the colours.
As an additional bonus, we can create an image that visualizes these colours for you. Assuming you have the image processing toolbox, this is the code I wrote to visualize those colours for each plot you place in your figure.
Here's what I got for MATLAB R2013a:
Running this code again in MATLAB R2015a, this is what I get:
Alternatively, you can always use a
legend
that delineates what histogram comes from which data.