[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting plots in Octave to show colors like Matlab.

From: RT
Subject: Getting plots in Octave to show colors like Matlab.
Date: Sun, 23 Apr 2017 09:55:27 -0400

I get two different plots using matlab 2013 and octave 4.0 see code below is there anyway to show the different colors in the plot like matlab shows using octave?

Input image of marbles.jpg:

pkg load image
rgbImage = imread('/tmp/marbles.jpg'););  % Load image Image of marbles.jpg:
hsvImage = rgb2hsv(rgbImage);         % Convert the image to HSV space
hPlane = 360.*hsvImage(:, :, 1);      % Get the hue plane scaled from 0 to 360

binEdges = 0:360;                 %# Edges of histogram bins
N = histc(hPlane(:),binEdges);    %# Bin the pixel hues from above
hBar = bar(binEdges(1:end-1),N(1:end-1),'histc');  %# Plot the histogram
set(hBar,'CData',1:360,...            %# Change the color of the bars using
         'CDataMapping','direct',...  %#   indexed color mapping (360 colors)
         'EdgeColor','none');         %#   and remove edge coloring
colormap(hsv(360));               %# Change to an HSV color map with 360 points
axis([0 360 0 max(N)]);           %# Change the axes limits
set(gca,'Color','k');             %# Change the axes background color
set(gcf,'Pos',[50 400 560 200]);  %# Change the figure size
xlabel('HSV hue (in degrees)');   %# Add an x label
ylabel('Bin counts');             %# Add a y label

Matlab 2013 what the Plot looks like

But when I create the plot with Octave 4.0 I get

The main goal is to have the histogram colors be the same as the matlab plot.  How can I fix this?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]